From 3e71e980c611ac9f00565564bd1e647194f74321 Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 16:07:12 +0330 Subject: closures: allow 24 parameters, like functions (was 19) --- tests/conformance/3-expressions/closure_24_parameters.zc | 6 ++++++ tests/langerrors/closure_params_25.zc | 3 +++ 2 files changed, 9 insertions(+) create mode 100644 tests/conformance/3-expressions/closure_24_parameters.zc create mode 100644 tests/langerrors/closure_params_25.zc (limited to 'tests') 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; } -- cgit v1.2.3