wcc: wwstage checks call arity at desugarcallargs
cstage rejects `add(1,2,3)` and `add(4)` (too many / not enough arguments); wwstage ran no count check at this seam, so both built -- a stray arg pushed silently, a missing one read garbage (cs-reject/ww-accept build-verdict divergence). Surplus errs when params exhaust with args left; missing errs on a leftover regular param (a leftover TK_ELLIPSIS or FFI "..." is a legal zero-arg variadic tail). fn-VALUE callees still bail at decl==nil -- their whole typecheck, arity included, stays task #51.
This commit is contained in:
8
test/wcc/data/call_arity_missing/case.ww
Normal file
8
test/wcc/data/call_arity_missing/case.ww
Normal file
@@ -0,0 +1,8 @@
|
||||
//ww:error "not enough arguments"
|
||||
// Arity, missing side: the callee read a garbage second param slot.
|
||||
package main;
|
||||
fn add(a: i64, b: i64) i64 = { return a + b; };
|
||||
export fn main() i32 = {
|
||||
let x: i64 = add(4);
|
||||
return x: i32;
|
||||
};
|
||||
9
test/wcc/data/call_arity_surplus/case.ww
Normal file
9
test/wcc/data/call_arity_surplus/case.ww
Normal file
@@ -0,0 +1,9 @@
|
||||
//ww:error "too many arguments"
|
||||
// Arity, surplus side: wwstage desugarcallargs ran no count check, so
|
||||
// a stray arg built and pushed silently (cs-reject/ww-accept).
|
||||
package main;
|
||||
fn add(a: i64, b: i64) i64 = { return a + b; };
|
||||
export fn main() i32 = {
|
||||
let x: i64 = add(1, 2, 3);
|
||||
return x: i32;
|
||||
};
|
||||
Reference in New Issue
Block a user