From 6bb3d79cbd853601623095b497a1807489c3ef6e Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 09:39:22 +0000 Subject: add c-style typedef and a built-in string alias typedef T name; binds name to the type record of T, at the top level or in a function (scoped to its block). string is a built-in alias for char*. A type name straight before , or ) in a parameter list is the parameter's name, so fn f(string) still works. The language server shows typedef T name; on hover and highlights typedef as a keyword. --- tests/test.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/test.sh') diff --git a/tests/test.sh b/tests/test.sh index 46625a6..df6417f 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -106,6 +106,7 @@ run(){ # $1 = vm command, $2 = label chk "$($vm < tests/programs/meta.zc | tr '\n' '/')" "1024 19/unless ok/rrr/15 42/7/42/7/144/" "$l parse words, quote, eval, load, operator tables" chk "$($vm < tests/programs/misc.zc | tr '\n' '/')" "45/54321/ok/" "$l compile-time eval, patched mnemonics, unchecked" chk "$($vm < tests/programs/types.zc | tr '\n' '/')" "12 5 2 15 56 42 7 14 3/rect rect* list* list*.u(int) T(list*) fn(word.d)/a:point@0 b:point@2 tag:int@4 /point 1 1/" "$l types, generics, reflection" + chk "$($vm < tests/programs/typedef.zc | tr '\n' '/')" "7 1 42 5 30/13 4 19 4/4 3 3 12/5 11/hihihihellook/8/" "$l typedef, global and local, in every place a type goes, and string" chk "$($vm < tests/programs/typeok.zc)" "14" "$l a program the typechecker accepts" chk "$($vm < tests/programs/typeoff.zc)" "6" "$l the typechecker is off by default" chk "$($vm < tests/programs/enhance.zc)" "100 0 343 3,2 5 -2 0" "$l virtual enhancements" -- cgit v1.2.3