mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
update a bunch of panic message to be capitalized
This commit is contained in:
parent
d37dd442f5
commit
298f93d20c
6 changed files with 26 additions and 26 deletions
|
@ -1229,7 +1229,7 @@ pub fn exportFromInt(comptime T: type, comptime name: []const u8) void {
|
||||||
|
|
||||||
const answer = @mulWithOverflow(this, RocDec.one_point_zero_i128);
|
const answer = @mulWithOverflow(this, RocDec.one_point_zero_i128);
|
||||||
if (answer[1] == 1) {
|
if (answer[1] == 1) {
|
||||||
roc_panic("Decimal conversion from integer failed!", 0);
|
roc_panic("Decimal conversion from Integer failed!", 0);
|
||||||
} else {
|
} else {
|
||||||
return answer[0];
|
return answer[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,7 @@ pub fn exportDivCeil(comptime T: type, comptime name: []const u8) void {
|
||||||
comptime var f = struct {
|
comptime var f = struct {
|
||||||
fn func(a: T, b: T) callconv(.C) T {
|
fn func(a: T, b: T) callconv(.C) T {
|
||||||
return math.divCeil(T, a, b) catch {
|
return math.divCeil(T, a, b) catch {
|
||||||
roc_panic("integer division by 0!", 0);
|
roc_panic("Integer division by 0!", 0);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}.func;
|
}.func;
|
||||||
|
@ -381,7 +381,7 @@ pub fn exportAddOrPanic(comptime T: type, comptime name: []const u8) void {
|
||||||
fn func(self: T, other: T) callconv(.C) T {
|
fn func(self: T, other: T) callconv(.C) T {
|
||||||
const result = addWithOverflow(T, self, other);
|
const result = addWithOverflow(T, self, other);
|
||||||
if (result.has_overflowed) {
|
if (result.has_overflowed) {
|
||||||
roc_panic("integer addition overflowed!", 0);
|
roc_panic("Integer addition overflowed!", 0);
|
||||||
} else {
|
} else {
|
||||||
return result.value;
|
return result.value;
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ pub fn exportSubOrPanic(comptime T: type, comptime name: []const u8) void {
|
||||||
fn func(self: T, other: T) callconv(.C) T {
|
fn func(self: T, other: T) callconv(.C) T {
|
||||||
const result = subWithOverflow(T, self, other);
|
const result = subWithOverflow(T, self, other);
|
||||||
if (result.has_overflowed) {
|
if (result.has_overflowed) {
|
||||||
roc_panic("integer subtraction overflowed!", 0);
|
roc_panic("Integer subtraction overflowed!", 0);
|
||||||
} else {
|
} else {
|
||||||
return result.value;
|
return result.value;
|
||||||
}
|
}
|
||||||
|
@ -622,7 +622,7 @@ pub fn exportMulOrPanic(comptime T: type, comptime W: type, comptime name: []con
|
||||||
fn func(self: T, other: T) callconv(.C) T {
|
fn func(self: T, other: T) callconv(.C) T {
|
||||||
const result = @call(.always_inline, mulWithOverflow, .{ T, W, self, other });
|
const result = @call(.always_inline, mulWithOverflow, .{ T, W, self, other });
|
||||||
if (result.has_overflowed) {
|
if (result.has_overflowed) {
|
||||||
roc_panic("integer multiplication overflowed!", 0);
|
roc_panic("Integer multiplication overflowed!", 0);
|
||||||
} else {
|
} else {
|
||||||
return result.value;
|
return result.value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1535,7 +1535,7 @@ fn build_int_binop<'ctx>(
|
||||||
)
|
)
|
||||||
.into_struct_value();
|
.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(),
|
NumAddWrap => bd.new_build_int_add(lhs, rhs, "add_int_wrap").into(),
|
||||||
NumAddChecked => {
|
NumAddChecked => {
|
||||||
|
@ -1566,7 +1566,7 @@ fn build_int_binop<'ctx>(
|
||||||
)
|
)
|
||||||
.into_struct_value();
|
.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(),
|
NumSubWrap => bd.new_build_int_sub(lhs, rhs, "sub_int").into(),
|
||||||
NumSubChecked => {
|
NumSubChecked => {
|
||||||
|
@ -1597,7 +1597,7 @@ fn build_int_binop<'ctx>(
|
||||||
)
|
)
|
||||||
.into_struct_value();
|
.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(),
|
NumMulWrap => bd.new_build_int_mul(lhs, rhs, "mul_int").into(),
|
||||||
NumMulSaturated => call_bitcode_fn(
|
NumMulSaturated => call_bitcode_fn(
|
||||||
|
@ -2350,7 +2350,7 @@ fn build_dec_binop<'a, 'ctx>(
|
||||||
bitcode::DEC_ADD_WITH_OVERFLOW,
|
bitcode::DEC_ADD_WITH_OVERFLOW,
|
||||||
lhs,
|
lhs,
|
||||||
rhs,
|
rhs,
|
||||||
"decimal addition overflowed",
|
"Decimal addition overflowed",
|
||||||
),
|
),
|
||||||
NumSub => build_dec_binop_throw_on_overflow(
|
NumSub => build_dec_binop_throw_on_overflow(
|
||||||
env,
|
env,
|
||||||
|
@ -2358,7 +2358,7 @@ fn build_dec_binop<'a, 'ctx>(
|
||||||
bitcode::DEC_SUB_WITH_OVERFLOW,
|
bitcode::DEC_SUB_WITH_OVERFLOW,
|
||||||
lhs,
|
lhs,
|
||||||
rhs,
|
rhs,
|
||||||
"decimal subtraction overflowed",
|
"Decimal subtraction overflowed",
|
||||||
),
|
),
|
||||||
NumMul => build_dec_binop_throw_on_overflow(
|
NumMul => build_dec_binop_throw_on_overflow(
|
||||||
env,
|
env,
|
||||||
|
@ -2366,7 +2366,7 @@ fn build_dec_binop<'a, 'ctx>(
|
||||||
bitcode::DEC_MUL_WITH_OVERFLOW,
|
bitcode::DEC_MUL_WITH_OVERFLOW,
|
||||||
lhs,
|
lhs,
|
||||||
rhs,
|
rhs,
|
||||||
"decimal multiplication overflowed",
|
"Decimal multiplication overflowed",
|
||||||
),
|
),
|
||||||
NumDivFrac => dec_binop_with_unchecked(env, bitcode::DEC_DIV, lhs, rhs),
|
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(
|
throw_internal_exception(
|
||||||
env,
|
env,
|
||||||
parent,
|
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);
|
builder.position_at_end(else_block);
|
||||||
|
@ -2690,7 +2690,7 @@ fn int_abs_raise_on_overflow<'ctx>(
|
||||||
throw_internal_exception(
|
throw_internal_exception(
|
||||||
env,
|
env,
|
||||||
parent,
|
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);
|
builder.position_at_end(else_block);
|
||||||
|
|
|
@ -1382,7 +1382,7 @@ impl<'a> LowLevelCall<'a> {
|
||||||
}
|
}
|
||||||
NumAbs => {
|
NumAbs => {
|
||||||
const PANIC_MSG: &str =
|
const PANIC_MSG: &str =
|
||||||
"integer absolute overflowed because its argument is the minimum value";
|
"Integer absolute overflowed because its argument is the minimum value";
|
||||||
|
|
||||||
self.load_args(backend);
|
self.load_args(backend);
|
||||||
|
|
||||||
|
@ -1446,7 +1446,7 @@ impl<'a> LowLevelCall<'a> {
|
||||||
}
|
}
|
||||||
NumNeg => {
|
NumNeg => {
|
||||||
const PANIC_MSG: &str =
|
const PANIC_MSG: &str =
|
||||||
"integer negation overflowed because its argument is the minimum value";
|
"Integer negation overflowed because its argument is the minimum value";
|
||||||
|
|
||||||
self.load_args(backend);
|
self.load_args(backend);
|
||||||
match CodeGenNumType::from(self.ret_layout) {
|
match CodeGenNumType::from(self.ret_layout) {
|
||||||
|
|
|
@ -2934,7 +2934,7 @@ fn list_map_with_index() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(expected = r#"Roc failed with message: "integer addition overflowed!"#)]
|
#[should_panic(expected = r#"Roc failed with message: "Integer addition overflowed!"#)]
|
||||||
fn cleanup_because_exception() {
|
fn cleanup_because_exception() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
|
|
|
@ -575,7 +575,7 @@ fn various_sized_abs() {
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(
|
#[should_panic(
|
||||||
expected = r#"Roc failed with message: "integer absolute overflowed because its argument is the minimum value"#
|
expected = r#"Roc failed with message: "Integer absolute overflowed because its argument is the minimum value"#
|
||||||
)]
|
)]
|
||||||
fn abs_min_int_overflow() {
|
fn abs_min_int_overflow() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
|
@ -808,7 +808,7 @@ fn gen_div_dec_by_zero() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(expected = r#"Roc failed with message: "integer division by 0!"#)]
|
#[should_panic(expected = r#"Roc failed with message: "Integer division by 0!"#)]
|
||||||
fn gen_div_ceil_by_zero() {
|
fn gen_div_ceil_by_zero() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
r#"
|
r#"
|
||||||
|
@ -1601,7 +1601,7 @@ fn int_negate() {
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(
|
#[should_panic(
|
||||||
expected = r#"Roc failed with message: "integer negation overflowed because its argument is the minimum value"#
|
expected = r#"Roc failed with message: "Integer negation overflowed because its argument is the minimum value"#
|
||||||
)]
|
)]
|
||||||
fn neg_min_int_overflow() {
|
fn neg_min_int_overflow() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
|
@ -1829,7 +1829,7 @@ fn atan() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(expected = r#"Roc failed with message: "integer addition overflowed!"#)]
|
#[should_panic(expected = r#"Roc failed with message: "Integer addition overflowed!"#)]
|
||||||
fn int_add_overflow() {
|
fn int_add_overflow() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
|
@ -1904,7 +1904,7 @@ fn float_add_overflow() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(expected = r#"Roc failed with message: "integer subtraction overflowed!"#)]
|
#[should_panic(expected = r#"Roc failed with message: "Integer subtraction overflowed!"#)]
|
||||||
fn int_sub_overflow() {
|
fn int_sub_overflow() {
|
||||||
assert_evals_to!("-9_223_372_036_854_775_808 - 1", 0, i64);
|
assert_evals_to!("-9_223_372_036_854_775_808 - 1", 0, i64);
|
||||||
}
|
}
|
||||||
|
@ -1989,7 +1989,7 @@ fn float_sub_checked() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(expected = r#"Roc failed with message: "integer multiplication overflowed!"#)]
|
#[should_panic(expected = r#"Roc failed with message: "Integer multiplication overflowed!"#)]
|
||||||
fn int_positive_mul_overflow() {
|
fn int_positive_mul_overflow() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
|
@ -2004,7 +2004,7 @@ fn int_positive_mul_overflow() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(expected = r#"Roc failed with message: "integer multiplication overflowed!"#)]
|
#[should_panic(expected = r#"Roc failed with message: "Integer multiplication overflowed!"#)]
|
||||||
fn int_negative_mul_overflow() {
|
fn int_negative_mul_overflow() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
|
@ -3927,21 +3927,21 @@ fn num_abs_diff_float() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(expected = r#"Roc failed with message: "integer subtraction overflowed!"#)]
|
#[should_panic(expected = r#"Roc failed with message: "Integer subtraction overflowed!"#)]
|
||||||
fn num_abs_max_overflow() {
|
fn num_abs_max_overflow() {
|
||||||
assert_evals_to!(r#"Num.absDiff Num.maxI64 -1"#, 0, i64);
|
assert_evals_to!(r#"Num.absDiff Num.maxI64 -1"#, 0, i64);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
#[should_panic(expected = r#"Roc failed with message: "integer subtraction overflowed!"#)]
|
#[should_panic(expected = r#"Roc failed with message: "Integer subtraction overflowed!"#)]
|
||||||
fn num_abs_int_min_overflow() {
|
fn num_abs_int_min_overflow() {
|
||||||
assert_evals_to!(r#"Num.absDiff Num.minI64 0"#, 0, i64);
|
assert_evals_to!(r#"Num.absDiff Num.minI64 0"#, 0, i64);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "gen-llvm")]
|
#[cfg(feature = "gen-llvm")]
|
||||||
#[should_panic(expected = r#"Roc failed with message: "integer subtraction overflowed!"#)]
|
#[should_panic(expected = r#"Roc failed with message: "Integer subtraction overflowed!"#)]
|
||||||
fn num_abs_large_bits_min_overflow() {
|
fn num_abs_large_bits_min_overflow() {
|
||||||
assert_evals_to!(r#"Num.absDiff Num.minI128 0"#, 0, i128);
|
assert_evals_to!(r#"Num.absDiff Num.minI128 0"#, 0, i128);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue