diff options
| author | 2026-10-14 16:07:12 +0330 | |
|---|---|---|
| committer | 2026-10-14 16:07:12 +0330 | |
| commit | 3e71e980c611ac9f00565564bd1e647194f74321 (patch) | |
| tree | 1a7c7fbafd94749c2439b17a74493b8598518a21 /tests | |
| parent | conformance: runtime index errors now end with an 'at <stdin>:N in main' trac... (diff) | |
closures: allow 24 parameters, like functions (was 19)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conformance/3-expressions/closure_24_parameters.zc | 6 | ||||
| -rw-r--r-- | tests/langerrors/closure_params_25.zc | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/conformance/3-expressions/closure_24_parameters.zc b/tests/conformance/3-expressions/closure_24_parameters.zc new file mode 100644 index 0000000..e12d258 --- /dev/null +++ b/tests/conformance/3-expressions/closure_24_parameters.zc @@ -0,0 +1,6 @@ +// expect: 300/ +// spec 3.15.1 and 5.2.2: a closure takes up to 24 parameters, like a function +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { let f = fn(int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8,int a9,int a10,int a11,int a12,int a13,int a14,int a15,int a16,int a17,int a18,int a19,int a20,int a21,int a22,int a23,int a24) { return a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24; }; pn(f(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24)); return 0; } +// zc0: skip diff --git a/tests/langerrors/closure_params_25.zc b/tests/langerrors/closure_params_25.zc new file mode 100644 index 0000000..0444007 --- /dev/null +++ b/tests/langerrors/closure_params_25.zc @@ -0,0 +1,3 @@ +// expect: too many parameters +include rt; +fn main() { let f = fn(int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8,int a9,int a10,int a11,int a12,int a13,int a14,int a15,int a16,int a17,int a18,int a19,int a20,int a21,int a22,int a23,int a24, int a25) { return 0; }; return 0; } |
