Skip to content

Test262: fromCodePoint surrogates (#108), call arg-order (#106), Object.create proto + isPrototypeOf (#104)#714

Merged
nickna merged 1 commit into
mainfrom
wrk/interesting-proskuriakova-e7be55
Jun 16, 2026
Merged

Test262: fromCodePoint surrogates (#108), call arg-order (#106), Object.create proto + isPrototypeOf (#104)#714
nickna merged 1 commit into
mainfrom
wrk/interesting-proskuriakova-e7be55

Conversation

@nickna

@nickna nickna commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Addresses Test262 issues #104, #105, #106, #108, #112. A recurring theme: most were substantially stale — intervening main work had already resolved much of each — so every issue was re-measured against the live baseline before acting.

What changed

#108String.fromCodePoint lone surrogates (fixed, both modes)

char.ConvertFromUtf32 throws on lone surrogates (0xD800–0xDFFF), but they are valid code points for fromCodePoint. Implemented ECMA-262 §11.1.3 UTF16EncodeCodePoint (cp <= 0xFFFF → single code unit incl. lone surrogates; else surrogate pair) in both the interpreter (StringBuiltIns.AppendCodePoint) and compiled (RuntimeEmitter.EmitStringFromCodePoint), and added the §22.1.2.2 integral check to the interpreter. Clears every RuntimeError in RegExp/CharacterClassEscapes/.

#106 — argument evaluation order vs. callability (fixed, compiled)

Per §13.3.2.1/§13.3.6.1, evaluating a member-access callee recv.method runs RequireObjectCoercible(recv) before ArgumentListEvaluation — so o.bar.gar(foo()) with o.bar undefined must throw TypeError before foo() runs. Compiled mode deferred the throw past the args. Added EmitThrowIfReceiverUndefined on the method-call path. It guards on $Undefined only (not bare null): compiled sloppy-mode this is represented as null and must stay coercible, so this.bar(foo()) still evaluates its args (this caught a 11.2.3-3_8 regression during development).

#104Object.create (interpreter parity, partial)

The interpreter lagged compiled badly. Two fixes: (1) validate the prototype argument (§20.1.2.2 step 1) and throw a real SharpTSTypeError for a non-Object/non-null proto — crucially via ThrowException(new SharpTSTypeError(...)), not new Exception("TypeError: …"), so assert.throws(TypeError, …)/instanceof see an Error instance (see #694); (2) Object.prototype.isPrototypeOf was a stub returning false — implemented the §20.1.3.4 chain walk. The titled core (iterating built-in property bags with accessors) needs accessor storage on Math/JSON/Date/Error/wrappers — a larger multi-type feature, scoped out and documented on #104.

#105 — built-in method .length + receiver guards (already satisfied)

Confirmed both modes already meet the spec (landed with #101). Added a regression suite (BuiltInMethodLengthAndReceiverTests) since the Test262 project isn't part of dotnet test.

#112 — RegExp Symbol.* edge cases (not fixed, triaged)

All 7 require infrastructure beyond focused scope: surrogate-aware unicode matching (overlaps #693), sloppy-this=globalThis binding, cross-realm $262.createRealm (no realm model — out of scope), and built-in-constructor property assignment (Array.print = print blocks coerce-global). Full per-cluster root-cause analysis posted to #112.

New issues filed

Tests / verification

  • Full unit suite: 12,740 pass, 0 regressions. Added regression tests for each fix (StringMethodTests, NonCallableInvocationTests, ObjectCreateTests, ObjectPrototypeTests, BuiltInMethodLengthAndReceiverTests).

Reviewer notes — Test262 baselines

The committed baseline changes are deliberately scoped to the folders these fixes deterministically affect (Object/create, RegExp/CharacterClassEscapes, the expressions/call/11.2.3-3 family): interpreted +45 lines, compiled +13 lines, all sensible transitions, no Pass → non-Pass regressions. A full regen surfaced large pre-existing drift (recent main work the stale baseline never captured) plus parallel-execution flakiness in unrelated paths; including that would muddy the diff and commit flaky values, so it's left for a maintainer full regen. No CI workflow runs the Test262 conformance suite, so this doesn't gate the PR.

…ct.create proto+isPrototypeOf (#104)

#108 — String.fromCodePoint rejected lone surrogates (0xD800-0xDFFF) because
char.ConvertFromUtf32 throws on them. Implement ECMA-262 §11.1.3
UTF16EncodeCodePoint in both modes (cp<=0xFFFF -> single code unit incl. lone
surrogates; else surrogate pair). Also enforce the §22.1.2.2 integral check in
the interpreter. Clears all RuntimeErrors in RegExp/CharacterClassEscapes; the
remaining \w/\s failures are the .NET ECMAScript-shorthand divergence (#693).

#106 — Compiled `o.bar.gar(foo())` evaluated arguments before the member-access
callee threw. Per §13.3.2.1/§13.3.6.1, evaluating `recv.method` runs
RequireObjectCoercible(recv) before ArgumentListEvaluation, so an undefined
receiver must throw TypeError before the args' side effects. Add
EmitThrowIfReceiverUndefined on the method-call path (EmitMethodCall +
EmitGetPropertyAndInvoke). Guards on $Undefined only — compiled sloppy `this`
is null and must stay coercible (avoids regressing this.bar(foo()), 11.2.3-3_8).

#104 — Interpreter Object.create lagged compiled. Two fixes: (1) validate the
prototype argument (§20.1.2.2 step 1) and throw a real SharpTSTypeError for a
non-Object/non-null proto, matching compiled; (2) Object.prototype.isPrototypeOf
was a stub returning false — implement the §20.1.3.4 chain walk. The titled
built-in property-bag accessor iteration remains (needs accessor storage on
Math/JSON/Date/Error/wrappers) — scoped out and documented on #104.

#105 already satisfied both modes; added a regression suite to lock .length +
receiver guards (Test262 isn't part of `dotnet test`).

Baselines updated only for the folders these changes deterministically affect
(Object/create, RegExp/CharacterClassEscapes, expressions/call 11.2.3-3); the
rest of the suite had drifted/was flaky under parallel regen and is left for a
maintainer full regen. Full unit suite: 12,740 pass.

Filed #693 (\w/\s ECMAScript shorthand class semantics) and #694 (interpreter
built-ins throwing string-typed TypeError instead of an Error instance).
@nickna nickna merged commit a6243ab into main Jun 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant