| author | |
| committer | |
| log | 022a71ca7d68d970418a93a5c5b3bec9e1fdf9f2 |
| tree | dfc52c034a80f3a3032778595afe1bd90c4194e4 |
| parent | 5974a887949c46df4bcb025da9369a31447c2f29 |
| signature |
* error message of ir_analyze_bit_shift now more accurate/specific
* fixed compile error test to match bit shift error message2 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 |
| 16974 | 16974 | ||
| 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 | } |
| 16980 | 16980 |
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 | }); |
| 5930 | 5930 | ||
| 5931 | cases.add("shifting RHS is log2 of LHS int bit width", | 5931 | cases.add("shifting RHS is log2 of LHS int bit width", |