authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-18 04:02:36-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-18 04:02:36-04:00
log6f0f8a92ec7cf7eac8c05469a46398f47885614e
tree6fa69eb154f595b8ef4d5424647df9eb050513a2
parent9021bb79695d378a864945f1d398083872ee6530

bail out of analysis on first error during comptime eval

prevents an error during comptime eval from printing a large number of compile errors

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

src/ir.cpp+9-2
......@@ -5849,7 +5849,7 @@ static IrInstruction *ir_exec_const_result(CodeGen *codegen, IrExecutable *exec)
58495849 return codegen->invalid_instruction;
58505850 }
58515851 }
5852 zig_unreachable();
5852 return codegen->invalid_instruction;
58535853}
58545854
58555855static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *source_instruction) {
......@@ -7741,7 +7741,11 @@ static int ir_eval_bignum(ConstExprValue *op1_val, ConstExprValue *op2_val,
77417741
77427742 bool overflow = bignum_fn(&out_val->data.x_bignum, &op1_val->data.x_bignum, &op2_val->data.x_bignum);
77437743 if (overflow) {
7744 return ErrorOverflow;
7744 if (wrapping_op) {
7745 zig_panic("TODO compiler bug, implement compile-time wrapping arithmetic for >= 64 bit ints");
7746 } else {
7747 return ErrorOverflow;
7748 }
77457749 }
77467750
77477751 if (type->id == TypeTableEntryIdInt && !bignum_fits_in_bits(&out_val->data.x_bignum,
......@@ -12985,6 +12989,9 @@ TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutabl
1298512989 }
1298612990
1298712991 TypeTableEntry *return_type = ir_analyze_instruction(ira, old_instruction);
12992 if (type_is_invalid(return_type) && ir_should_inline(new_exec, old_instruction->scope)) {
12993 break;
12994 }
1298812995
1298912996 // unreachable instructions do their own control flow.
1299012997 if (return_type->id == TypeTableEntryIdUnreachable)