diff --git a/hilti/toolchain/src/compiler/parser/parser.yy b/hilti/toolchain/src/compiler/parser/parser.yy index 9703b9610..4f0ac77a7 100644 --- a/hilti/toolchain/src/compiler/parser/parser.yy +++ b/hilti/toolchain/src/compiler/parser/parser.yy @@ -793,7 +793,7 @@ ctor : CBOOL { $$ = hilti::ctor::Bool($1, __ | CSTRING { $$ = hilti::ctor::String($1, __loc__); } | CUINTEGER { $$ = hilti::ctor::UnsignedInteger($1, 64, __loc__); } | '+' CUINTEGER { if ( $2 > static_cast(std::numeric_limits::max()) ) - logger().error("integer constant out of range C1", __loc__.location()); + logger().error("integer constant out of range", __loc__.location()); $$ = hilti::ctor::SignedInteger($2, 64, __loc__); } diff --git a/hilti/toolchain/src/compiler/visitors/constant-folder.cc b/hilti/toolchain/src/compiler/visitors/constant-folder.cc index 36853e8e4..62262b1e8 100644 --- a/hilti/toolchain/src/compiler/visitors/constant-folder.cc +++ b/hilti/toolchain/src/compiler/visitors/constant-folder.cc @@ -64,7 +64,7 @@ struct VisitorConstantFolder : public visitor::PreOrder, Vis // Helper to cast an uint64 to int64, with range check. int64_t to_int64(uint64_t x, position_t& p) { if ( x > static_cast(std::numeric_limits::max()) ) - throw hilti::rt::OutOfRange("integer value out of range A1"); + throw hilti::rt::OutOfRange("integer value out of range"); return static_cast(x); } @@ -75,7 +75,7 @@ struct VisitorConstantFolder : public visitor::PreOrder, Vis // Helper to cast an int64 to uint64, with range check. uint64_t to_uint64(int64_t x, position_t& p) { if ( x < 0 ) - throw hilti::rt::OutOfRange("integer value out of range A2"); + throw hilti::rt::OutOfRange("integer value out of range"); return static_cast(x); } @@ -96,7 +96,7 @@ struct VisitorConstantFolder : public visitor::PreOrder, Vis return std::nullopt; if ( op->value() > std::abs(std::numeric_limits::min()) ) - throw hilti::rt::OutOfRange("integer value out of range A3"); + throw hilti::rt::OutOfRange("integer value out of range"); return ctor::SignedInteger(-static_cast(op->value()), op->width(), p.node.meta()); } diff --git a/hilti/toolchain/src/compiler/visitors/validator.cc b/hilti/toolchain/src/compiler/visitors/validator.cc index 9205274ba..09b310779 100644 --- a/hilti/toolchain/src/compiler/visitors/validator.cc +++ b/hilti/toolchain/src/compiler/visitors/validator.cc @@ -257,7 +257,7 @@ struct VisitorPost : public hilti::visitor::PreOrder, public auto [min, max] = util::signed_integer_range(n.width()); if ( n.value() < min || n.value() > max ) - error("integer value out of range for type B1", p); + error("integer value out of range for type", p); } void operator()(const ctor::Set& n, position_t p) { @@ -273,7 +273,7 @@ struct VisitorPost : public hilti::visitor::PreOrder, public auto [min, max] = util::unsigned_integer_range(n.width()); if ( n.value() < min || n.value() > max ) - error("integer value out of range for type B2", p); + error("integer value out of range for type", p); } void operator()(const ctor::Vector& n, position_t p) { diff --git a/spicy/toolchain/src/compiler/parser/parser.yy b/spicy/toolchain/src/compiler/parser/parser.yy index 6a43fa6ad..a64d9196a 100644 --- a/spicy/toolchain/src/compiler/parser/parser.yy +++ b/spicy/toolchain/src/compiler/parser/parser.yy @@ -957,7 +957,7 @@ ctor : CADDRESS { $$ = hilti::ctor::Address(hil | CSTRING { $$ = hilti::ctor::String($1, __loc__); } | CUINTEGER { $$ = hilti::ctor::UnsignedInteger($1, 64, __loc__); } | '+' CUINTEGER { if ( $2 > static_cast(std::numeric_limits::max()) ) - hilti::logger().error("integer constant out of range C1", __loc__.location()); + hilti::logger().error("integer constant out of range", __loc__.location()); $$ = hilti::ctor::SignedInteger($2, 64, __loc__); } diff --git a/tests/Baseline/hilti.types.integer.ctor-fail-2/output b/tests/Baseline/hilti.types.integer.ctor-fail-2/output index bad224190..e5434e650 100644 --- a/tests/Baseline/hilti.types.integer.ctor-fail-2/output +++ b/tests/Baseline/hilti.types.integer.ctor-fail-2/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.hlt:2:18: integer value out of range A3 -[error] hiltic: errors encountered during normalizing +[error] <...>/ctor-fail.hlt:2:18: integer value out of range +[error] hiltic: aborting after errors diff --git a/tests/Baseline/hilti.types.integer.ctor-fail-3/output b/tests/Baseline/hilti.types.integer.ctor-fail-3/output index d78b29fea..b0679a2ac 100644 --- a/tests/Baseline/hilti.types.integer.ctor-fail-3/output +++ b/tests/Baseline/hilti.types.integer.ctor-fail-3/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.hlt:2:12: integer value out of range A2 -[error] hiltic: errors encountered during normalizing +[error] <...>/ctor-fail.hlt:2:12: integer value out of range +[error] hiltic: aborting after errors diff --git a/tests/Baseline/hilti.types.integer.ctor-fail-4/output b/tests/Baseline/hilti.types.integer.ctor-fail-4/output index 4c3e0310a..8e97ec7e3 100644 --- a/tests/Baseline/hilti.types.integer.ctor-fail-4/output +++ b/tests/Baseline/hilti.types.integer.ctor-fail-4/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.hlt:2:12: integer value out of range for type B2 +[error] <...>/ctor-fail.hlt:2:12: integer value out of range for type [error] hiltic: aborting after errors diff --git a/tests/Baseline/hilti.types.integer.ctor-fail-5/output b/tests/Baseline/hilti.types.integer.ctor-fail-5/output index d78b29fea..b0679a2ac 100644 --- a/tests/Baseline/hilti.types.integer.ctor-fail-5/output +++ b/tests/Baseline/hilti.types.integer.ctor-fail-5/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.hlt:2:12: integer value out of range A2 -[error] hiltic: errors encountered during normalizing +[error] <...>/ctor-fail.hlt:2:12: integer value out of range +[error] hiltic: aborting after errors diff --git a/tests/Baseline/hilti.types.integer.ctor-fail-6/output b/tests/Baseline/hilti.types.integer.ctor-fail-6/output index d78b29fea..b0679a2ac 100644 --- a/tests/Baseline/hilti.types.integer.ctor-fail-6/output +++ b/tests/Baseline/hilti.types.integer.ctor-fail-6/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.hlt:2:12: integer value out of range A2 -[error] hiltic: errors encountered during normalizing +[error] <...>/ctor-fail.hlt:2:12: integer value out of range +[error] hiltic: aborting after errors diff --git a/tests/Baseline/hilti.types.integer.ctor-fail-7/output b/tests/Baseline/hilti.types.integer.ctor-fail-7/output index c86bd4a4e..8e97ec7e3 100644 --- a/tests/Baseline/hilti.types.integer.ctor-fail-7/output +++ b/tests/Baseline/hilti.types.integer.ctor-fail-7/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.hlt:2:12: integer value out of range for type B1 +[error] <...>/ctor-fail.hlt:2:12: integer value out of range for type [error] hiltic: aborting after errors diff --git a/tests/Baseline/hilti.types.integer.ctor-fail-8/output b/tests/Baseline/hilti.types.integer.ctor-fail-8/output index c806c02a0..d118fbe3a 100644 --- a/tests/Baseline/hilti.types.integer.ctor-fail-8/output +++ b/tests/Baseline/hilti.types.integer.ctor-fail-8/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.hlt:2:12: integer constant out of range C1 +[error] <...>/ctor-fail.hlt:2:12: integer constant out of range [error] hiltic: parse error diff --git a/tests/Baseline/hilti.types.integer.ctor-fail/output b/tests/Baseline/hilti.types.integer.ctor-fail/output index 23027c923..3f962fae9 100644 --- a/tests/Baseline/hilti.types.integer.ctor-fail/output +++ b/tests/Baseline/hilti.types.integer.ctor-fail/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.hlt:7:12: integer value out of range A1 -[error] hiltic: errors encountered during normalizing +[error] <...>/ctor-fail.hlt:7:12: integer value out of range +[error] hiltic: aborting after errors diff --git a/tests/Baseline/spicy.types.integer.ctor-fail-3/output b/tests/Baseline/spicy.types.integer.ctor-fail-3/output index 3b67c73dd..12c14cb18 100644 --- a/tests/Baseline/spicy.types.integer.ctor-fail-3/output +++ b/tests/Baseline/spicy.types.integer.ctor-fail-3/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.spicy:1:28: unsigned integer value out of range -[error] spicyc: errors encountered during normalizing +[error] <...>/ctor-fail.spicy:1:28: integer value out of range +[error] spicyc: aborting after errors diff --git a/tests/Baseline/spicy.types.integer.ctor-fail-4/output b/tests/Baseline/spicy.types.integer.ctor-fail-4/output index 240ab6989..192f0e686 100644 --- a/tests/Baseline/spicy.types.integer.ctor-fail-4/output +++ b/tests/Baseline/spicy.types.integer.ctor-fail-4/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.spicy:1:29: unsigned integer value out of range -[error] spicyc: errors encountered during normalizing +[error] <...>/ctor-fail.spicy:1:29: integer value out of range +[error] spicyc: aborting after errors diff --git a/tests/Baseline/spicy.types.integer.ctor-fail-5/output b/tests/Baseline/spicy.types.integer.ctor-fail-5/output index 2a2afe307..2210b8cd4 100644 --- a/tests/Baseline/spicy.types.integer.ctor-fail-5/output +++ b/tests/Baseline/spicy.types.integer.ctor-fail-5/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.spicy:1:27: unsigned integer value out of range -[error] spicyc: errors encountered during normalizing +[error] <...>/ctor-fail.spicy:1:27: integer value out of range +[error] spicyc: aborting after errors diff --git a/tests/Baseline/spicy.types.integer.ctor-fail-6/output b/tests/Baseline/spicy.types.integer.ctor-fail-6/output index 240ab6989..192f0e686 100644 --- a/tests/Baseline/spicy.types.integer.ctor-fail-6/output +++ b/tests/Baseline/spicy.types.integer.ctor-fail-6/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.spicy:1:29: unsigned integer value out of range -[error] spicyc: errors encountered during normalizing +[error] <...>/ctor-fail.spicy:1:29: integer value out of range +[error] spicyc: aborting after errors diff --git a/tests/Baseline/spicy.types.integer.ctor-fail-8/output b/tests/Baseline/spicy.types.integer.ctor-fail-8/output index 273a428d1..a02d1221b 100644 --- a/tests/Baseline/spicy.types.integer.ctor-fail-8/output +++ b/tests/Baseline/spicy.types.integer.ctor-fail-8/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.spicy:4:17: signed integer value out of range -[error] spicyc: errors encountered during normalizing +[error] <...>/ctor-fail.spicy:4:17: integer value out of range +[error] spicyc: aborting after errors diff --git a/tests/Baseline/spicy.types.integer.ctor-fail-9/output b/tests/Baseline/spicy.types.integer.ctor-fail-9/output index 610d73d4e..e9a2cbe6b 100644 --- a/tests/Baseline/spicy.types.integer.ctor-fail-9/output +++ b/tests/Baseline/spicy.types.integer.ctor-fail-9/output @@ -1,3 +1,3 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[error] <...>/ctor-fail.spicy:3:23: signed integer value out of range -[error] spicyc: parse error +[error] <...>/ctor-fail.spicy:3:23: integer value out of range +[error] spicyc: aborting after errors diff --git a/tests/hilti/types/integer/ctor-fail.hlt b/tests/hilti/types/integer/ctor-fail.hlt index 5b94bb616..231dc7da1 100644 --- a/tests/hilti/types/integer/ctor-fail.hlt +++ b/tests/hilti/types/integer/ctor-fail.hlt @@ -4,40 +4,40 @@ # @TEST-DOC: Test a series of out-of-range integer constructors. module Test { -global x = int64(9223372036854775808); # max_int64 + 1 / A1 +global x = int64(9223372036854775808); # max_int64 + 1 } @TEST-START-NEXT module Test { -global x = int64(-9223372036854775809); # min_int64 - 1 / A3 +global x = int64(-9223372036854775809); # min_int64 - 1 } @TEST-START-NEXT module Test { -global x = uint64(-1); # < 0 / A2 +global x = uint64(-1); } @TEST-START-NEXT module Test { -global x = uint8(256); # B2 +global x = uint8(256); } @TEST-START-NEXT module Test { -global x = uint8(-256); # A2 +global x = uint8(-256); } @TEST-START-NEXT module Test { -global x = uint8(-1); # A2 +global x = uint8(-1); } @TEST-START-NEXT module Test { -global x = int8(128); # B1 +global x = int8(128); } @TEST-START-NEXT module Test { -global x = +9223372036854775808; # C1 +global x = +9223372036854775808; }