diff options
Diffstat (limited to 'testsuite')
| -rw-r--r-- | testsuite/compilable/const_element_array.elna | 9 | ||||
| -rw-r--r-- | testsuite/compilable/const_extern.elna | 5 | ||||
| -rw-r--r-- | testsuite/fail_compilation/assign_const_element.elna | 11 |
3 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/compilable/const_element_array.elna b/testsuite/compilable/const_element_array.elna new file mode 100644 index 0000000..a812d23 --- /dev/null +++ b/testsuite/compilable/const_element_array.elna @@ -0,0 +1,9 @@ +type + CI = const Int + +var + a: [3]CI := [1, 2, 3] + b: [3]CI + +begin +end. diff --git a/testsuite/compilable/const_extern.elna b/testsuite/compilable/const_extern.elna new file mode 100644 index 0000000..8df801e --- /dev/null +++ b/testsuite/compilable/const_extern.elna @@ -0,0 +1,5 @@ +var + errno_like: const Int := extern + +begin +end. diff --git a/testsuite/fail_compilation/assign_const_element.elna b/testsuite/fail_compilation/assign_const_element.elna new file mode 100644 index 0000000..9b9c341 --- /dev/null +++ b/testsuite/fail_compilation/assign_const_element.elna @@ -0,0 +1,11 @@ +type + CI = const Int + +proc f() +var + a: [3]CI := [1, 2, 3] +begin + a[1] := 6 (* @Error Cannot assign to a value of type 'CI', because it is constant or contains constant members *) +return + +end. |
