aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/zc0typed.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/programs/zc0typed.zc')
-rw-r--r--tests/programs/zc0typed.zc10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/programs/zc0typed.zc b/tests/programs/zc0typed.zc
index 4b7f438..81209bf 100644
--- a/tests/programs/zc0typed.zc
+++ b/tests/programs/zc0typed.zc
@@ -1,20 +1,22 @@
+namespace;
+
// the stage 0 compiler (src/tools/zc0.c) has no types. it reads them and throws
// them away, so a typed program and the same program without the types come
// out as the same image. tests/programs/zc0plain.zc is this file with the types off.
int total;
-[8]int table;
-[]word names;
+int[8] table;
+word[?] names;
const int LIMIT = 10;
int add(int a, int b) { return a + b; }
-.u grow([]word v, int n) { return v; }
+.u grow(word[?] v, int n) { return v; }
bool keep(int.d x, .m y) { return x != y; }
int apply(int(int) f, int* p, vec<vec<int>>*.u q) { return f(*p); }
int sq(int x) { return x * x; }
fn start() {
int i = 0, sum = 0;
- [4]int a;
+ int[4] a;
int* p = a;
for (int j = 0; j < LIMIT; j++) sum = add(sum, sq(j));
while (i < 4) { a[i] = i; i++; }