Merge pull request #6062 from JRMurr/div-0-should-crash

Update zig `@panic` calls to `roc_panic` for numeric errors
This commit is contained in:
Brendan Hansknecht 2023-12-05 12:28:47 -08:00 committed by GitHub
commit e336aa525c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 71 additions and 47 deletions

View file

@ -1535,7 +1535,7 @@ fn build_int_binop<'ctx>(
)
.into_struct_value();
throw_on_overflow(env, parent, result, "integer addition overflowed!")
throw_on_overflow(env, parent, result, "Integer addition overflowed!")
}
NumAddWrap => bd.new_build_int_add(lhs, rhs, "add_int_wrap").into(),
NumAddChecked => {
@ -1566,7 +1566,7 @@ fn build_int_binop<'ctx>(
)
.into_struct_value();
throw_on_overflow(env, parent, result, "integer subtraction overflowed!")
throw_on_overflow(env, parent, result, "Integer subtraction overflowed!")
}
NumSubWrap => bd.new_build_int_sub(lhs, rhs, "sub_int").into(),
NumSubChecked => {
@ -1597,7 +1597,7 @@ fn build_int_binop<'ctx>(
)
.into_struct_value();
throw_on_overflow(env, parent, result, "integer multiplication overflowed!")
throw_on_overflow(env, parent, result, "Integer multiplication overflowed!")
}
NumMulWrap => bd.new_build_int_mul(lhs, rhs, "mul_int").into(),
NumMulSaturated => call_bitcode_fn(
@ -2350,7 +2350,7 @@ fn build_dec_binop<'a, 'ctx>(
bitcode::DEC_ADD_WITH_OVERFLOW,
lhs,
rhs,
"decimal addition overflowed",
"Decimal addition overflowed",
),
NumSub => build_dec_binop_throw_on_overflow(
env,
@ -2358,7 +2358,7 @@ fn build_dec_binop<'a, 'ctx>(
bitcode::DEC_SUB_WITH_OVERFLOW,
lhs,
rhs,
"decimal subtraction overflowed",
"Decimal subtraction overflowed",
),
NumMul => build_dec_binop_throw_on_overflow(
env,
@ -2366,7 +2366,7 @@ fn build_dec_binop<'a, 'ctx>(
bitcode::DEC_MUL_WITH_OVERFLOW,
lhs,
rhs,
"decimal multiplication overflowed",
"Decimal multiplication overflowed",
),
NumDivFrac => dec_binop_with_unchecked(env, bitcode::DEC_DIV, lhs, rhs),
@ -2659,7 +2659,7 @@ fn int_neg_raise_on_overflow<'ctx>(
throw_internal_exception(
env,
parent,
"integer negation overflowed because its argument is the minimum value",
"Integer negation overflowed because its argument is the minimum value",
);
builder.position_at_end(else_block);
@ -2690,7 +2690,7 @@ fn int_abs_raise_on_overflow<'ctx>(
throw_internal_exception(
env,
parent,
"integer absolute overflowed because its argument is the minimum value",
"Integer absolute overflowed because its argument is the minimum value",
);
builder.position_at_end(else_block);