Summary
Function.prototype.call/.apply on a builtin prototype method returns undefined — the method isn't a first-class function value. This is the general case of #1722 (which fixed it only for stdlib namespace methods like path.join).
Repro (confirmed, perry 0.5.1028)
function viaProto() { return Array.prototype.slice.call(arguments, 1); }
console.log(typeof Array.prototype.slice); // Perry: "undefined" Node: "function"
console.log(Array.prototype.slice.call([9,8,7], 1)); // Perry: TypeError (reading 'call') Node: [8,7]
[].slice.call(arguments); // same: "Cannot read properties of undefined (reading 'call')"
Array.prototype.slice (and array-instance .slice as a value, not a direct call) evaluate to undefined, so .call/.apply on them throws.
Why it matters
[].slice.call(arguments) / Array.prototype.slice.call(arguments) is one of the most common idioms in real-world JS (arguments-to-array, polyfills, every older library). In the #800 node-core radar it's the single largest concentrated runtime-fail cluster — ~117 tests (fs-heavy), because the test harness's mustSucceed/mustCall use it. Likely affects Array.prototype.map/forEach/..., Object.prototype.hasOwnProperty.call, etc. too.
Scope
Extend #1722's fix from stdlib-namespace methods to builtin prototype methods (Array/Object/String/Function prototypes): make Proto.method and instance.method resolve to a real callable so .call/.apply (and passing the method as a callback) dispatch to the native implementation.
Context: discovered clustering the full #800 radar sweep (1300 judged tests).
Summary
Function.prototype.call/.applyon a builtin prototype method returnsundefined— the method isn't a first-class function value. This is the general case of #1722 (which fixed it only for stdlib namespace methods likepath.join).Repro (confirmed, perry 0.5.1028)
Array.prototype.slice(and array-instance.sliceas a value, not a direct call) evaluate toundefined, so.call/.applyon them throws.Why it matters
[].slice.call(arguments)/Array.prototype.slice.call(arguments)is one of the most common idioms in real-world JS (arguments-to-array, polyfills, every older library). In the #800 node-core radar it's the single largest concentrated runtime-fail cluster — ~117 tests (fs-heavy), because the test harness'smustSucceed/mustCalluse it. Likely affectsArray.prototype.map/forEach/...,Object.prototype.hasOwnProperty.call, etc. too.Scope
Extend #1722's fix from stdlib-namespace methods to builtin prototype methods (Array/Object/String/Function prototypes): make
Proto.methodandinstance.methodresolve to a real callable so.call/.apply(and passing the method as a callback) dispatch to the native implementation.Context: discovered clustering the full #800 radar sweep (1300 judged tests).