Summary
Several built-in prototype methods should immediately throw TypeError when called with this equal to null or undefined, but currently accept/coerce those nullish receivers or crash later.
Why
Enabling --compat-for-in-loop surfaced newly failing test262 coverage:
staging/sm/misc/builtin-methods-reject-null-undefined-this.js
The test loops over built-in method tables and checks .call(null), .apply(undefined), and bare calls. This is ordinary ECMAScript receiver-validation behavior, not a for...in semantics issue.
Current behavior
A targeted probe reports methods that do not throw the required TypeError, including:
Object.prototype.toLocaleString
Object.prototype.valueOf
Array.prototype.toLocaleString
Boolean.prototype.toString
Boolean.prototype.valueOf
Number.prototype.toLocaleString
Date.prototype.toLocaleString
The broader probe later hits an access violation while continuing through Date methods, which suggests there may be both missing RequireObjectCoercible/brand checks and native-method crash paths.
Reproduction through the pinned test262 runner:
./build.pas loaderbare
bun scripts/run_test262_suite.ts \
--suite-dir /tmp/test262-suite-pinned \
--categories staging \
--filter 'staging/sm/misc/builtin-methods-reject-null-undefined-this.js' \
--mode bytecode \
--jobs 1 \
--verbose
Current result is an ordinary conformance FAIL, not wrapper infra:
Interpreted mode reports [object Object], indicating the assertion failure is reaching the runner but the error formatting is not very diagnostic.
Expected behavior
Built-in prototype methods whose spec algorithms require object/primitive-wrapper receivers should reject null and undefined with TypeError before doing any later operation. Bare method calls should also reject because the receiver becomes undefined after de-referencing.
Scope notes
Likely fix areas include receiver validation in built-in prototype methods for Object, Array, Boolean, Number, Date, String, RegExp, and Error. The test intentionally includes some missing legacy methods; missing methods already throw via undefined.call(...), but implemented methods need correct receiver checks.
Summary
Several built-in prototype methods should immediately throw
TypeErrorwhen called withthisequal tonullorundefined, but currently accept/coerce those nullish receivers or crash later.Why
Enabling
--compat-for-in-loopsurfaced newly failing test262 coverage:staging/sm/misc/builtin-methods-reject-null-undefined-this.jsThe test loops over built-in method tables and checks
.call(null),.apply(undefined), and bare calls. This is ordinary ECMAScript receiver-validation behavior, not afor...insemantics issue.Current behavior
A targeted probe reports methods that do not throw the required
TypeError, including:The broader probe later hits an access violation while continuing through Date methods, which suggests there may be both missing
RequireObjectCoercible/brand checks and native-method crash paths.Reproduction through the pinned test262 runner:
./build.pas loaderbare bun scripts/run_test262_suite.ts \ --suite-dir /tmp/test262-suite-pinned \ --categories staging \ --filter 'staging/sm/misc/builtin-methods-reject-null-undefined-this.js' \ --mode bytecode \ --jobs 1 \ --verboseCurrent result is an ordinary conformance FAIL, not wrapper infra:
Interpreted mode reports
[object Object], indicating the assertion failure is reaching the runner but the error formatting is not very diagnostic.Expected behavior
Built-in prototype methods whose spec algorithms require object/primitive-wrapper receivers should reject
nullandundefinedwithTypeErrorbefore doing any later operation. Bare method calls should also reject because the receiver becomesundefinedafter de-referencing.Scope notes
Likely fix areas include receiver validation in built-in prototype methods for Object, Array, Boolean, Number, Date, String, RegExp, and Error. The test intentionally includes some missing legacy methods; missing methods already throw via
undefined.call(...), but implemented methods need correct receiver checks.