checkCallArity compares the supplied count against the declared params (min = params without trailing defaults, max = params.len, unbounded past a variadic) at the five plain dispatch sites in lowerCall — bare selected-author + lazy, namespace alias-gate + qualified, struct method, ufcs. Pack / comptime / generic / #compiler / #builtin callees keep their own dispatch. The method/ufcs sites also gain the appendDefaultArgs fill the generic-instance leg already had, so trailing defaults work on dot-calls instead of emitting under-arity calls. lowerStmt's local fn_decl arm now registers a pointer into the AST node in fn_ast_map, not a stack temporary that aliased every later local fn.
30 lines
1.0 KiB
Plaintext
30 lines
1.0 KiB
Plaintext
error: 'add2' expects 2 arguments, but 3 were given
|
|
--> examples/1167-diagnostics-call-arity-mismatch.sx:19:9
|
|
|
|
|
19 | _ = add2(1, 2, 3); // plain bare call, too many
|
|
| ^^^^
|
|
|
|
error: 'add2' expects 2 arguments, but 1 was given
|
|
--> examples/1167-diagnostics-call-arity-mismatch.sx:20:9
|
|
|
|
|
20 | _ = add2(1); // plain bare call, too few
|
|
| ^^^^
|
|
|
|
error: 'concat' expects 2 arguments, but 3 were given
|
|
--> examples/1167-diagnostics-call-arity-mismatch.sx:21:9
|
|
|
|
|
21 | _ = concat("a", "b", "c"); // flat-imported stdlib fn, too many
|
|
| ^^^^^^
|
|
|
|
error: 'Point.scaled' expects 1 argument, but 2 were given
|
|
--> examples/1167-diagnostics-call-arity-mismatch.sx:23:9
|
|
|
|
|
23 | _ = p.scaled(2, 9); // method dot-call, too many
|
|
| ^^^^^^^^
|
|
|
|
error: 'bump' expects 1 argument, but 2 were given
|
|
--> examples/1167-diagnostics-call-arity-mismatch.sx:24:9
|
|
|
|
|
24 | _ = p.bump(1, 2); // ufcs dot-call, too many
|
|
| ^^^^^^
|