diff options
Diffstat (limited to 'testsuite/fail_compilation')
5 files changed, 53 insertions, 0 deletions
diff --git a/testsuite/fail_compilation/assign_to_call_result_field.elna b/testsuite/fail_compilation/assign_to_call_result_field.elna new file mode 100644 index 0000000..509b2dd --- /dev/null +++ b/testsuite/fail_compilation/assign_to_call_result_field.elna @@ -0,0 +1,15 @@ +type + R = record + x: Int + end + +proc make() -> R +var + result: R +begin + result.x := 1 +return result + +begin + make().x := 5 (* @Error Expression of type 'Int' is not addressable *) +end. diff --git a/testsuite/fail_compilation/assign_to_slicing.elna b/testsuite/fail_compilation/assign_to_slicing.elna new file mode 100644 index 0000000..2266431 --- /dev/null +++ b/testsuite/fail_compilation/assign_to_slicing.elna @@ -0,0 +1,7 @@ +var + s: [3]Int + t: [2]Int + +begin + s[1 to 2] := t[1 to 2] (* @Error Expression of type '\[\]Int' is not addressable *) +end. diff --git a/testsuite/fail_compilation/reference_call_result_field.elna b/testsuite/fail_compilation/reference_call_result_field.elna new file mode 100644 index 0000000..5051cc8 --- /dev/null +++ b/testsuite/fail_compilation/reference_call_result_field.elna @@ -0,0 +1,18 @@ +type + R = record + x: Int + end + +var + p: ^Int + +proc make() -> R +var + result: R +begin + result.x := 1 +return result + +begin + p := @make().x (* @Error Expression of type 'Int' is not addressable *) +end. diff --git a/testsuite/fail_compilation/reference_literal.elna b/testsuite/fail_compilation/reference_literal.elna new file mode 100644 index 0000000..1967243 --- /dev/null +++ b/testsuite/fail_compilation/reference_literal.elna @@ -0,0 +1,6 @@ +var + p: ^Int + +begin + p := @5 (* @Error Expression of type 'Int' is not addressable *) +end. diff --git a/testsuite/fail_compilation/reference_slicing.elna b/testsuite/fail_compilation/reference_slicing.elna new file mode 100644 index 0000000..fac8ec6 --- /dev/null +++ b/testsuite/fail_compilation/reference_slicing.elna @@ -0,0 +1,7 @@ +var + s: [3]Int + p: ^Int + +begin + p := @s[1 to 2] (* @Error Expression of type '\[\]Int' is not addressable *) +end. |
