From f8daedce5c73e02dfb2fc59d75777190185584df Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 29 Jul 2026 01:16:18 +0200 Subject: Validate cast compatibility during semantic analysis --- testsuite/fail_compilation/while_condition.elna | 2 +- testsuite/runnable/slice_cast.elna | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 testsuite/runnable/slice_cast.elna (limited to 'testsuite') diff --git a/testsuite/fail_compilation/while_condition.elna b/testsuite/fail_compilation/while_condition.elna index 73fed95..1e17489 100644 --- a/testsuite/fail_compilation/while_condition.elna +++ b/testsuite/fail_compilation/while_condition.elna @@ -1,4 +1,4 @@ begin - while 1 do (* @Error Condition must be a boolean, got 'Int' *) + while 1 do (* @Error Condition must be a boolean expression, but got 'Int' *) end end. diff --git a/testsuite/runnable/slice_cast.elna b/testsuite/runnable/slice_cast.elna new file mode 100644 index 0000000..5ab2c93 --- /dev/null +++ b/testsuite/runnable/slice_cast.elna @@ -0,0 +1,6 @@ +var + ints: [4]Int := [4]Int{ 1, 2, 3, 4 } + +begin + assert(cast(ints[1u to 4u]: []Char).length = #size(Int) * ints.length) +end. -- cgit v1.2.3