aboutsummaryrefslogtreecommitdiff
path: root/testsuite/fail_compilation
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/fail_compilation')
-rw-r--r--testsuite/fail_compilation/assign_const_array_pointer.elna9
-rw-r--r--testsuite/fail_compilation/assign_const_member.elna14
-rw-r--r--testsuite/fail_compilation/assign_const_primitive.elna8
-rw-r--r--testsuite/fail_compilation/assign_const_record_pointer.elna17
-rw-r--r--testsuite/fail_compilation/assign_deep_const_pointer.elna9
-rw-r--r--testsuite/fail_compilation/assign_element_of_const.elna8
-rw-r--r--testsuite/fail_compilation/assign_member_of_const.elna13
-rw-r--r--testsuite/fail_compilation/local_const_exported.elna6
8 files changed, 78 insertions, 6 deletions
diff --git a/testsuite/fail_compilation/assign_const_array_pointer.elna b/testsuite/fail_compilation/assign_const_array_pointer.elna
new file mode 100644
index 0000000..32dc66d
--- /dev/null
+++ b/testsuite/fail_compilation/assign_const_array_pointer.elna
@@ -0,0 +1,9 @@
+proc f()
+var
+ p: ^[2]Int
+ q: ^const [2]Int
+begin
+ p := q (* @Error Expected type '\^\[2\]Int', but got '\^const \[2\]Int' *)
+return
+
+end.
diff --git a/testsuite/fail_compilation/assign_const_member.elna b/testsuite/fail_compilation/assign_const_member.elna
new file mode 100644
index 0000000..8aecb01
--- /dev/null
+++ b/testsuite/fail_compilation/assign_const_member.elna
@@ -0,0 +1,14 @@
+type
+ R = record
+ x: const Int
+ end
+
+proc f()
+var
+ r1: R := R{ x: 5 }
+ r2: R := R{ x: 5 }
+begin
+ r1 := r2 (* @Error Cannot assign to a value of type 'R', because it is constant or contains constant members *)
+return
+
+end.
diff --git a/testsuite/fail_compilation/assign_const_primitive.elna b/testsuite/fail_compilation/assign_const_primitive.elna
new file mode 100644
index 0000000..34b095b
--- /dev/null
+++ b/testsuite/fail_compilation/assign_const_primitive.elna
@@ -0,0 +1,8 @@
+proc f()
+var
+ x: const Int
+begin
+ x := 5 (* @Error Cannot assign to a value of type 'const Int', because it is constant or contains constant members *)
+return
+
+end.
diff --git a/testsuite/fail_compilation/assign_const_record_pointer.elna b/testsuite/fail_compilation/assign_const_record_pointer.elna
new file mode 100644
index 0000000..5e6f3df
--- /dev/null
+++ b/testsuite/fail_compilation/assign_const_record_pointer.elna
@@ -0,0 +1,17 @@
+type
+ B = record
+ x: Int
+ end
+ D = record(B)
+ y: Int
+ end
+
+proc f()
+var
+ b: ^B
+ d: ^const D
+begin
+ b := d (* @Error Expected type '\^B', but got '\^const D' *)
+return
+
+end.
diff --git a/testsuite/fail_compilation/assign_deep_const_pointer.elna b/testsuite/fail_compilation/assign_deep_const_pointer.elna
new file mode 100644
index 0000000..7ed3840
--- /dev/null
+++ b/testsuite/fail_compilation/assign_deep_const_pointer.elna
@@ -0,0 +1,9 @@
+proc f()
+var
+ p: ^^const Int
+ q: ^^Int
+begin
+ p := q (* @Error Expected type '\^\^const Int', but got '\^\^Int' *)
+return
+
+end.
diff --git a/testsuite/fail_compilation/assign_element_of_const.elna b/testsuite/fail_compilation/assign_element_of_const.elna
new file mode 100644
index 0000000..9afd520
--- /dev/null
+++ b/testsuite/fail_compilation/assign_element_of_const.elna
@@ -0,0 +1,8 @@
+proc f()
+var
+ a: const [2]Int
+begin
+ a[1] := 6 (* @Error Cannot assign to a value of type 'const Int', because it is constant or contains constant members *)
+return
+
+end.
diff --git a/testsuite/fail_compilation/assign_member_of_const.elna b/testsuite/fail_compilation/assign_member_of_const.elna
new file mode 100644
index 0000000..fc945bb
--- /dev/null
+++ b/testsuite/fail_compilation/assign_member_of_const.elna
@@ -0,0 +1,13 @@
+type
+ R = record
+ x: Int
+ end
+
+proc f()
+var
+ r: const R := R{ x: 5 }
+begin
+ r.x := 6 (* @Error Cannot assign to a value of type 'const Int', because it is constant or contains constant members *)
+return
+
+end.
diff --git a/testsuite/fail_compilation/local_const_exported.elna b/testsuite/fail_compilation/local_const_exported.elna
deleted file mode 100644
index 1c6c728..0000000
--- a/testsuite/fail_compilation/local_const_exported.elna
+++ /dev/null
@@ -1,6 +0,0 @@
-proc test_local_export()
-const
- c* := 42 (* @Error Local symbol 'c' cannot be exported *)
-return
-
-end.