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
signaturebadge-question-mark 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...@@ -16974,7 +16974,7 @@ static IrInstGen *ir_analyze_bit_shift(IrAnalyze *ira, IrInstSrcBinOp *bin_op_in
1697416974
16975 if (!instr_is_comptime(op2)) {16975 if (!instr_is_comptime(op2)) {
16976 ir_add_error(ira, &bin_op_instruction->base.base,16976 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"));
16978 return ira->codegen->invalid_inst_gen;16978 return ira->codegen->invalid_inst_gen;
16979 }16979 }
1698016980
test/compile_errors.zig+1-1
...@@ -5925,7 +5925,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -5925,7 +5925,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
5925 \\ return 0x11 << x;5925 \\ return 0x11 << x;
5926 \\}5926 \\}
5927 , &[_][]const u8{5927 , &[_][]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",
5929 });5929 });
59305930
5931 cases.add("shifting RHS is log2 of LHS int bit width",5931 cases.add("shifting RHS is log2 of LHS int bit width",