From ca5d682edb1553cd73c581a1726537e6415fe848 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 25 Feb 2024 12:50:11 +0100 Subject: Fix cast order for `ToInt` (#3485) --- tests/typ/bugs/int-constructor.typ | 7 +++++++ tests/typ/compiler/bytes.typ | 2 +- tests/typ/compute/calc.typ | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 tests/typ/bugs/int-constructor.typ (limited to 'tests') diff --git a/tests/typ/bugs/int-constructor.typ b/tests/typ/bugs/int-constructor.typ new file mode 100644 index 00000000..0bdce612 --- /dev/null +++ b/tests/typ/bugs/int-constructor.typ @@ -0,0 +1,7 @@ +// Test that integer -> integer conversion doesn't do a roundtrip through float. +// Ref: false + +--- +#let x = 9223372036854775800 +#test(type(x), int) +#test(int(x), x) diff --git a/tests/typ/compiler/bytes.typ b/tests/typ/compiler/bytes.typ index 9a26e826..284ef773 100644 --- a/tests/typ/compiler/bytes.typ +++ b/tests/typ/compiler/bytes.typ @@ -28,5 +28,5 @@ #bytes((a: 1)) --- -// Error: 8-15 expected bytes, array, or version, found string +// Error: 8-15 expected array, bytes, or version, found string #array("hello") diff --git a/tests/typ/compute/calc.typ b/tests/typ/compute/calc.typ index acd9b2a8..94a13105 100644 --- a/tests/typ/compute/calc.typ +++ b/tests/typ/compute/calc.typ @@ -53,11 +53,11 @@ #test(calc.round(calc.pi, digits: 2), 3.14) --- -// Error: 6-10 expected boolean, float, string, or integer, found length +// Error: 6-10 expected integer, boolean, float, or string, found length #int(10pt) --- -// Error: 8-13 expected boolean, integer, ratio, string, or float, found type +// Error: 8-13 expected float, boolean, integer, ratio, or string, found type #float(float) --- -- cgit v1.2.3