aboutsummaryrefslogtreecommitdiff
path: root/docs/history/15-o3/code/tests/langerrors
diff options
context:
space:
mode:
authorGravatar Moon Flower <moonflower@elhenney.local> 2026-10-12 08:46:23 +0330
committerGravatar Moon Flower <moonflower@elhenney.local> 2026-10-12 08:46:23 +0330
commitecc350ca5c2eb50be8309c5f14f8bf0d87db9a02 (patch)
tree70e0af76a1b13affff7c6cc8aac7b3e6ef960478 /docs/history/15-o3/code/tests/langerrors
a
Diffstat (limited to 'docs/history/15-o3/code/tests/langerrors')
-rw-r--r--docs/history/15-o3/code/tests/langerrors/const_index.zc2
-rw-r--r--docs/history/15-o3/code/tests/langerrors/fixed_nolen.zc2
-rw-r--r--docs/history/15-o3/code/tests/langerrors/fixed_push.zc2
-rw-r--r--docs/history/15-o3/code/tests/langerrors/fixed_to_dyn.zc4
-rw-r--r--docs/history/15-o3/code/tests/langerrors/o3_addr.zc2
-rw-r--r--docs/history/15-o3/code/tests/langerrors/o3_asm.zc2
-rw-r--r--docs/history/15-o3/code/tests/langerrors/o3_let.zc2
-rw-r--r--docs/history/15-o3/code/tests/langerrors/o3_param.zc3
8 files changed, 19 insertions, 0 deletions
diff --git a/docs/history/15-o3/code/tests/langerrors/const_index.zc b/docs/history/15-o3/code/tests/langerrors/const_index.zc
new file mode 100644
index 0000000..03e927b
--- /dev/null
+++ b/docs/history/15-o3/code/tests/langerrors/const_index.zc
@@ -0,0 +1,2 @@
+// expect: the index is out of range for this array
+fn main() { [4]int a; a[4] = 1; return 0; }
diff --git a/docs/history/15-o3/code/tests/langerrors/fixed_nolen.zc b/docs/history/15-o3/code/tests/langerrors/fixed_nolen.zc
new file mode 100644
index 0000000..b79c31e
--- /dev/null
+++ b/docs/history/15-o3/code/tests/langerrors/fixed_nolen.zc
@@ -0,0 +1,2 @@
+// expect: a fixed array needs its length
+fn main() { fixed []int f = new(fixed []int); free(d*f); return 0; }
diff --git a/docs/history/15-o3/code/tests/langerrors/fixed_push.zc b/docs/history/15-o3/code/tests/langerrors/fixed_push.zc
new file mode 100644
index 0000000..a19bcb4
--- /dev/null
+++ b/docs/history/15-o3/code/tests/langerrors/fixed_push.zc
@@ -0,0 +1,2 @@
+// expect: a fixed array can't grow or shrink
+fn main() { fixed []int f = new(fixed []int, 3); push(f, 1); free(d*f); return 0; }
diff --git a/docs/history/15-o3/code/tests/langerrors/fixed_to_dyn.zc b/docs/history/15-o3/code/tests/langerrors/fixed_to_dyn.zc
new file mode 100644
index 0000000..483f62f
--- /dev/null
+++ b/docs/history/15-o3/code/tests/langerrors/fixed_to_dyn.zc
@@ -0,0 +1,4 @@
+// expect: type error: argument: expected []int, got fixed []int
+typecheck on;
+int take([]int.m g) { return len(g); }
+fn main() { fixed []int f = new(fixed []int, 3); take(f); free(d*f); return 0; }
diff --git a/docs/history/15-o3/code/tests/langerrors/o3_addr.zc b/docs/history/15-o3/code/tests/langerrors/o3_addr.zc
new file mode 100644
index 0000000..815253d
--- /dev/null
+++ b/docs/history/15-o3/code/tests/langerrors/o3_addr.zc
@@ -0,0 +1,2 @@
+// expect: an o3 variable has no address
+fn main() { o3 int z = 2; *int q = &z; return *q; }
diff --git a/docs/history/15-o3/code/tests/langerrors/o3_asm.zc b/docs/history/15-o3/code/tests/langerrors/o3_asm.zc
new file mode 100644
index 0000000..c8afb44
--- /dev/null
+++ b/docs/history/15-o3/code/tests/langerrors/o3_asm.zc
@@ -0,0 +1,2 @@
+// expect: asm can't reach an o3 variable
+fn main() { o3 int zz = 2; asm { zz @ _ } return 0; }
diff --git a/docs/history/15-o3/code/tests/langerrors/o3_let.zc b/docs/history/15-o3/code/tests/langerrors/o3_let.zc
new file mode 100644
index 0000000..d2aff9a
--- /dev/null
+++ b/docs/history/15-o3/code/tests/langerrors/o3_let.zc
@@ -0,0 +1,2 @@
+// expect: o3 variables need a type
+fn main() { o3 { let x = 1; x++; } return 0; }
diff --git a/docs/history/15-o3/code/tests/langerrors/o3_param.zc b/docs/history/15-o3/code/tests/langerrors/o3_param.zc
new file mode 100644
index 0000000..5694720
--- /dev/null
+++ b/docs/history/15-o3/code/tests/langerrors/o3_param.zc
@@ -0,0 +1,3 @@
+// expect: o3 parameters need a type
+o3 int f(x) { return x; }
+fn main() { return f(1); }