diff options
Diffstat (limited to 'tests/programs/typeok.zc')
| -rw-r--r-- | tests/programs/typeok.zc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/programs/typeok.zc b/tests/programs/typeok.zc index 26ab3ad..72a254a 100644 --- a/tests/programs/typeok.zc +++ b/tests/programs/typeok.zc @@ -1,21 +1,24 @@ +namespace; +include rt; + // passes the typechecker: words mix with everything, literal 0 is null, // arrays decay to pointers, generic calls bind their parameters typecheck on; struct pair<A, B> { A a; B b; }; -pair<A, B>*.u mk<A, B>(A x, B y) { pair<A, B>* p = new(pair<A, B>); p.a = x; p.b = y; return u*p; } +pair<A, B>*.u mk<A, B>(A x, B y) { pair<A, B>* p = rt.new(pair<A, B>); p.a = x; p.b = y; return u*p; } A left<A, B>(pair<A, B>* p) { return p.a; } int strlen2(char* s) { int n = 0; while (s[n]) n++; return n; } int main() { pair<int, char*>* p = mk(3, "four"); int a = left(p); char* s = p.b; - [8]char buf; + char[8] buf; char* q = buf; int* nothing = 0; let w = 5; int mixed = w + 1; q[0] = 'h'; q[1] = 0; - put_n(a + strlen2(s) + strlen2(buf) + mixed); put_c(10); - free(d*p); + rt.put_n(a + strlen2(s) + strlen2(buf) + mixed); rt.put_c(10); + rt.free(d*p); return 0; } |
