//ww:run // #59.8: a variadic call through a struct fn-pointer FIELD with a // spread-forwarded tail (`v.cb(v, args...)`). The pre-fix wwstage // classified the callee by NAME: with no registry hit the raw // N_SPREAD leaked to pushargsrev as a single $0 word (callee saw // args.ptr=0), and when the base local shadowed the module name it // picked the module fn's signature and mis-counted nfixed. package main; type vt = struct { cb: fn(v: *vt, args: i64...) void, acc: i64, }; fn sum(v: *vt, args: i64...) void = { let i: i32 = 0; for (i < args.len) { v.acc += args[i]; i += 1; }; }; fn dispatch(v: *vt, args: i64...) void = { v.cb(v, args...); }; fn main() i32 = { let v: vt; v.cb = sum; v.acc = 0i64; dispatch(&v, 1i64, 2i64, 3i64); if (v.acc != 6i64) { return 1; }; v.cb(&v, 10i64); if (v.acc != 16i64) { return 2; }; return 0; };