Summary
Follow-up to #705 (case b). In --compile --ref-asm (reference-assembly emit) mode, calling a function expression / arrow as a value does not apply a value-type parameter default for an omitted argument. Plain --compile and the interpreter are correct.
Repro
const f = function (x: number, y: number = 3) { return x + y; };
console.log(f(4));
| mode |
result |
| interpreter |
7 |
--compile |
7 |
--compile --ref-asm |
3 ← BUG (default y = 3 not applied, y is 0) |
Notes
Discovered
While implementing #705.
Summary
Follow-up to #705 (case b). In
--compile --ref-asm(reference-assembly emit) mode, calling a function expression / arrow as a value does not apply a value-type parameter default for an omitted argument. Plain--compileand the interpreter are correct.Repro
7--compile7--compile --ref-asm3← BUG (defaulty = 3not applied,yis 0)Notes
undefined(yields NaN) #705's fix: Compiled: function expressions / arrow functions ignore default parameter values for omitted arguments #646 already widened arrow/function-expression defaulted params to anobjectslot, and plain--compileapplies the default via the entry prologue. The--ref-asmvalue-call path does not. (Before Compiled: function expressions / arrow functions ignore default parameter values for omitted arguments #646 this same case produced an invalid-ILStackUnexpectederror, so--ref-asmwas already broken here.)--ref-asmvalue-call dispatch for widenedobjectparams — the omitted slot is not being padded with the$Undefinedsentinel (or the entry prologue is not reached) on that path.Discovered
While implementing #705.