diff options
| author | Veikka Tuominen <git@vexu.eu> | 2023-01-19 18:44:09 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-01-22 00:12:37 +0200 |
| commit | 5f5ab491684f0f5dd235189416f9c3d85e8e9be0 (patch) | |
| tree | 51d450c61c1ece9b6208d0904ab306f660502251 /src/Sema.zig | |
| parent | a492a607d5410b1136db3a63fabd01c10827144c (diff) | |
| download | zig-5f5ab491684f0f5dd235189416f9c3d85e8e9be0.tar.gz zig-5f5ab491684f0f5dd235189416f9c3d85e8e9be0.zip | |
Value: implement `compareAllWithZero` for `bytes` and `str_lit`
Closes #10692
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 8da24b72cc..a0a071c572 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -11842,7 +11842,7 @@ fn zirShl( if (scalar_ty.zigTypeTag() == .ComptimeInt) { break :val shifted.wrapped_result; } - if (shifted.overflow_bit.compareAllWithZero(.eq)) { + if (shifted.overflow_bit.compareAllWithZero(.eq, sema.mod)) { break :val shifted.wrapped_result; } return sema.fail(block, src, "operation caused overflow", .{}); @@ -12831,7 +12831,7 @@ fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins const lhs_val = maybe_lhs_val orelse unreachable; const rhs_val = maybe_rhs_val orelse unreachable; const rem = lhs_val.floatRem(rhs_val, resolved_type, sema.arena, mod) catch unreachable; - if (!rem.compareAllWithZero(.eq)) { + if (!rem.compareAllWithZero(.eq, mod)) { return sema.fail(block, src, "ambiguous coercion of division operands '{s}' and '{s}'; non-zero remainder '{}'", .{ @tagName(lhs_ty.tag()), @tagName(rhs_ty.tag()), rem.fmtValue(resolved_type, sema.mod), }); @@ -13024,7 +13024,7 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai if (maybe_rhs_val) |rhs_val| { if (is_int) { const modulus_val = try lhs_val.intMod(rhs_val, resolved_type, sema.arena, mod); - if (!(modulus_val.compareAllWithZero(.eq))) { + if (!(modulus_val.compareAllWithZero(.eq, mod))) { return sema.fail(block, src, "exact division produced remainder", .{}); } const res = try lhs_val.intDiv(rhs_val, resolved_type, sema.arena, mod); @@ -13035,7 +13035,7 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai return sema.addConstant(resolved_type, res); } else { const modulus_val = try lhs_val.floatMod(rhs_val, resolved_type, sema.arena, mod); - if (!(modulus_val.compareAllWithZero(.eq))) { + if (!(modulus_val.compareAllWithZero(.eq, mod))) { return sema.fail(block, src, "exact division produced remainder", .{}); } return sema.addConstant( |
