authorgravatar for buzdav2@gmail.comfoobles <buzdav2@gmail.com> 2020-04-14 15:19:45-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-04-14 16:19:45-04:00
log022a71ca7d68d970418a93a5c5b3bec9e1fdf9f2
treedfc52c034a80f3a3032778595afe1bd90c4194e4
parent5974a887949c46df4bcb025da9369a31447c2f29
signature Signed by PGP key 4AEE18F83AFDEB23

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

2 files changed, 2 insertions(+), 2 deletions(-)

src/ir.cpp+1-1
......@@ -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+1-1
......@@ -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",