Skip to content

Test262: RegExp Symbol.* protocol — 7 remaining spec-edge cases (unicode lastIndex, replacer this, cross-realm) #112

Description

@nickna

Motivation

Follow-up to #101, which hardened the RegExp.prototype[Symbol.*] protocol to ECMA-262 §22.2.5 across both modes. That issue is now effectively complete — the Symbol.* surface passes 204/207 interpreted and 201/207 compiled (the remaining 9-per-mode skips are the separate regexp-named-groups feature).

This issue carves out the 7 distinct spec-edge test files that still fail, so the remaining work has an explicit, closeable target.

Remaining failing tests

Interpreted (3):

  • test/built-ins/RegExp/prototype/Symbol.replace/coerce-global.js — RuntimeError
  • test/built-ins/RegExp/prototype/Symbol.replace/fn-invoke-this-no-strict.js
  • test/built-ins/RegExp/prototype/Symbol.split/splitter-proto-from-ctor-realm.js — RuntimeError

Compiled (6, two shared with interpreter):

  • test/built-ins/RegExp/prototype/Symbol.match/builtin-infer-unicode.js
  • test/built-ins/RegExp/prototype/Symbol.match/builtin-success-u-return-val-groups.js
  • test/built-ins/RegExp/prototype/Symbol.search/u-lastindex-advance.js
  • test/built-ins/RegExp/prototype/Symbol.split/u-lastindex-adv-thru-match.js
  • test/built-ins/RegExp/prototype/Symbol.replace/fn-invoke-this-no-strict.js (also fails interpreted)
  • test/built-ins/RegExp/prototype/Symbol.split/splitter-proto-from-ctor-realm.js — RuntimeError (also fails interpreted)

Work clusters

1. Unicode-flag lastIndex advancement (4 compiled tests) — highest leverage

  • Symbol.match/builtin-infer-unicode.js
  • Symbol.match/builtin-success-u-return-val-groups.js
  • Symbol.search/u-lastindex-advance.js
  • Symbol.split/u-lastindex-adv-thru-match.js

The compiled exec loop needs surrogate-pair-aware index stepping when the u flag is set (§22.2.7.3 AdvanceStringIndex). The interpreter already passes these, so the C# reference exists — this is an IL port of the unicode advance step.

2. Replacer-fn this in non-strict mode (1 test, both modes)

  • Symbol.replace/fn-invoke-this-no-strict.js

The replacer function passed to Symbol.replace must be invoked with undefined this, which in non-strict mode coerces to the global object. Both modes currently mishandle the this binding.

3. Cross-realm prototype provenance (1 test, both modes)

  • Symbol.split/splitter-proto-from-ctor-realm.js

The species-constructed splitter must take its prototype from the constructor's realm. This likely needs realm support SharpTS does not model; may be out of scope — acceptable to mark Skipped with a feature tag if realms aren't planned.

Also (interpreted-only)

  • Symbol.replace/coerce-global.js — RuntimeError; likely related to cluster 1's global/unicode flag handling on the interpreter side.

Acceptance

  • Clusters 1 and 2 flip to Pass in both modes (6 of 7 files).
  • Cluster 3 either passes or is explicitly skipped with a realm-feature tag and a note.
  • No regressions in RegExp/prototype/* or String/prototype/* baselines.

Related

Follow-up to #101. Part of #69.

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferredDe-prioritized; not planned for active work (see tracking comment)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions