fix(0123): wrong arg counts to fixed-arity fns error at the call site
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.
This commit is contained in:
@@ -179,7 +179,10 @@ pub fn lowerStmt(self: *Lowering, node: *const Node) void {
|
||||
switch (node.data) {
|
||||
.var_decl => |vd| self.lowerVarDecl(&vd),
|
||||
.const_decl => |cd| self.lowerConstDecl(&cd),
|
||||
.fn_decl => |fd| self.lowerLocalFnDecl(&fd),
|
||||
// Pointer capture, not by-value: `lowerLocalFnDecl` registers the
|
||||
// decl pointer in `fn_ast_map`, so it must point into the AST node,
|
||||
// not at a stack temporary that the next statement reuses.
|
||||
.fn_decl => |*fd| self.lowerLocalFnDecl(fd),
|
||||
.return_stmt => |rs| self.lowerReturn(&rs),
|
||||
.raise_stmt => |rs| self.lowerRaise(&rs, node.span),
|
||||
.assignment => |asgn| self.lowerAssignment(&asgn),
|
||||
|
||||
Reference in New Issue
Block a user