From 1e0f89df48ba10cdde80bd623b84e20fb48b977d Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 24 Jul 2026 21:28:33 +0200 Subject: Accept any constant types in case labels --- testsuite/fail_compilation/case_non_constant.elna | 16 ++++++++++++++++ testsuite/fail_compilation/case_type_mismatch.elna | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 testsuite/fail_compilation/case_non_constant.elna create mode 100644 testsuite/fail_compilation/case_type_mismatch.elna (limited to 'testsuite/fail_compilation') diff --git a/testsuite/fail_compilation/case_non_constant.elna b/testsuite/fail_compilation/case_non_constant.elna new file mode 100644 index 0000000..2f19df8 --- /dev/null +++ b/testsuite/fail_compilation/case_non_constant.elna @@ -0,0 +1,16 @@ +type + R = record + a: Int; + b: Int + end + +var + r: R + x: R + +begin + x := r; + case x of + r: (* @Error Expected a constant expression *) + end +end. diff --git a/testsuite/fail_compilation/case_type_mismatch.elna b/testsuite/fail_compilation/case_type_mismatch.elna new file mode 100644 index 0000000..9cdae38 --- /dev/null +++ b/testsuite/fail_compilation/case_type_mismatch.elna @@ -0,0 +1,9 @@ +var + x: Int + +begin + case x of + 1: (* ok *) + | true: (* @Error Invalid operands of type 'Int' and 'Bool' for operator = *) + end +end. -- cgit v1.2.3