Skip to content

Commit 022a71c

Browse files
authored
Shift error message now says "fixed-width integer type" instead of just "integer type" (#5028)
* error message of ir_analyze_bit_shift now more accurate/specific * fixed compile error test to match bit shift error message
1 parent 5974a88 commit 022a71c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/ir.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16974,7 +16974,7 @@ static IrInstGen *ir_analyze_bit_shift(IrAnalyze *ira, IrInstSrcBinOp *bin_op_in
1697416974

1697516975
if (!instr_is_comptime(op2)) {
1697616976
ir_add_error(ira, &bin_op_instruction->base.base,
16977-
buf_sprintf("LHS of shift must be an integer type, or RHS must be compile-time known"));
16977+
buf_sprintf("LHS of shift must be a fixed-width integer type, or RHS must be compile-time known"));
1697816978
return ira->codegen->invalid_inst_gen;
1697916979
}
1698016980

test/compile_errors.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5925,7 +5925,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
59255925
\\ return 0x11 << x;
59265926
\\}
59275927
, &[_][]const u8{
5928-
"tmp.zig:2:17: error: LHS of shift must be an integer type, or RHS must be compile-time known",
5928+
"tmp.zig:2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be compile-time known",
59295929
});
59305930

59315931
cases.add("shifting RHS is log2 of LHS int bit width",

0 commit comments

Comments
 (0)