| ... | @@ -1214,11 +1214,11 @@ fn analyzeInstSwitchRange(mod: *Module, scope: *Scope, inst: *zir.Inst.BinOp) In | ... | @@ -1214,11 +1214,11 @@ fn analyzeInstSwitchRange(mod: *Module, scope: *Scope, inst: *zir.Inst.BinOp) In |
| 1214 | const end = try resolveInst(mod, scope, inst.positionals.rhs); | 1214 | const end = try resolveInst(mod, scope, inst.positionals.rhs); |
| 1215 | | 1215 | |
| 1216 | switch (start.ty.zigTypeTag()) { | 1216 | switch (start.ty.zigTypeTag()) { |
| 1217 | .Int, .ComptimeInt, .Float, .ComptimeFloat => {}, | 1217 | .Int, .ComptimeInt => {}, |
| 1218 | else => return mod.constVoid(scope, inst.base.src), | 1218 | else => return mod.constVoid(scope, inst.base.src), |
| 1219 | } | 1219 | } |
| 1220 | switch (end.ty.zigTypeTag()) { | 1220 | switch (end.ty.zigTypeTag()) { |
| 1221 | .Int, .ComptimeInt, .Float, .ComptimeFloat => {}, | 1221 | .Int, .ComptimeInt => {}, |
| 1222 | else => return mod.constVoid(scope, inst.base.src), | 1222 | else => return mod.constVoid(scope, inst.base.src), |
| 1223 | } | 1223 | } |
| 1224 | if (start.value()) |start_val| { | 1224 | if (start.value()) |start_val| { |
| ... | @@ -1280,7 +1280,7 @@ fn validateSwitch(mod: *Module, scope: *Scope, target: *Inst, inst: *zir.Inst.Sw | ... | @@ -1280,7 +1280,7 @@ fn validateSwitch(mod: *Module, scope: *Scope, target: *Inst, inst: *zir.Inst.Sw |
| 1280 | // check that target type supports ranges | 1280 | // check that target type supports ranges |
| 1281 | if (inst.kw_args.range) |range_inst| { | 1281 | if (inst.kw_args.range) |range_inst| { |
| 1282 | switch (target.ty.zigTypeTag()) { | 1282 | switch (target.ty.zigTypeTag()) { |
| 1283 | .Int, .ComptimeInt, .Float, .ComptimeFloat => {}, | 1283 | .Int, .ComptimeInt => {}, |
| 1284 | else => { | 1284 | else => { |
| 1285 | return mod.fail(scope, target.src, "ranges not allowed when switching on type {}", .{target.ty}); | 1285 | return mod.fail(scope, target.src, "ranges not allowed when switching on type {}", .{target.ty}); |
| 1286 | // TODO notes "range used here" range_inst.src | 1286 | // TODO notes "range used here" range_inst.src |
| ... | @@ -1291,7 +1291,6 @@ fn validateSwitch(mod: *Module, scope: *Scope, target: *Inst, inst: *zir.Inst.Sw | ... | @@ -1291,7 +1291,6 @@ fn validateSwitch(mod: *Module, scope: *Scope, target: *Inst, inst: *zir.Inst.Sw |
| 1291 | // validate for duplicate items/missing else prong | 1291 | // validate for duplicate items/missing else prong |
| 1292 | switch (target.ty.zigTypeTag()) { | 1292 | switch (target.ty.zigTypeTag()) { |
| 1293 | .Int, .ComptimeInt => return mod.fail(scope, inst.base.src, "TODO validateSwitch .Int, .ComptimeInt", .{}), | 1293 | .Int, .ComptimeInt => return mod.fail(scope, inst.base.src, "TODO validateSwitch .Int, .ComptimeInt", .{}), |
| 1294 | .Float, .ComptimeFloat => return mod.fail(scope, inst.base.src, "TODO validateSwitch .Float, .ComptimeFloat", .{}), | | |
| 1295 | .Enum => return mod.fail(scope, inst.base.src, "TODO validateSwitch .Enum", .{}), | 1294 | .Enum => return mod.fail(scope, inst.base.src, "TODO validateSwitch .Enum", .{}), |
| 1296 | .ErrorSet => return mod.fail(scope, inst.base.src, "TODO validateSwitch .ErrorSet", .{}), | 1295 | .ErrorSet => return mod.fail(scope, inst.base.src, "TODO validateSwitch .ErrorSet", .{}), |
| 1297 | .Union => return mod.fail(scope, inst.base.src, "TODO validateSwitch .Union", .{}), | 1296 | .Union => return mod.fail(scope, inst.base.src, "TODO validateSwitch .Union", .{}), |
| ... | @@ -1350,6 +1349,8 @@ fn validateSwitch(mod: *Module, scope: *Scope, target: *Inst, inst: *zir.Inst.Sw | ... | @@ -1350,6 +1349,8 @@ fn validateSwitch(mod: *Module, scope: *Scope, target: *Inst, inst: *zir.Inst.Sw |
| 1350 | .Vector, | 1349 | .Vector, |
| 1351 | .Frame, | 1350 | .Frame, |
| 1352 | .AnyFrame, | 1351 | .AnyFrame, |
| | 1352 | .ComptimeFloat, |
| | 1353 | .Float, |
| 1353 | => { | 1354 | => { |
| 1354 | return mod.fail(scope, target.src, "invalid switch target type '{}'", .{target.ty}); | 1355 | return mod.fail(scope, target.src, "invalid switch target type '{}'", .{target.ty}); |
| 1355 | }, | 1356 | }, |