Skip to content

Fix string matching property access order - #1848

Open
trestoncuzzort wants to merge 1 commit into
quickjs-ng:masterfrom
trestoncuzzort:string-match-regexp-create
Open

trestoncuzzort wants to merge 1 commit into
quickjs-ng:masterfrom
trestoncuzzort:string-match-regexp-create

Conversation

@trestoncuzzort

@trestoncuzzort trestoncuzzort commented Oct 26, 2026 •

Copy link
Copy Markdown

Fixes #1796.

Check IsRegExp and the global flag before reading Symbol.matchAll. Implement the RegExpCreate fallback in match, search and matchAll by converting and compiling the pattern directly, avoiding extra Symbol.match and source reads and honoring an overridden RegExp toString().

The regression covers getter order, changing flags, custom matcher receivers, pattern conversion and exceptions. Three groups fail on the original engine; all four pass after the fix.

Validation against the exact base and submitted revisions:

  • Linux GCC 16: all 121 local files pass, nine excluded. Full pinned test262: both revisions retain 40 known failures across 82,220 tests, with no expectation changes.
  • Windows MSVC x64: full local suite, C API tests, all 119 relevant conformance cases and original/fixed regression controls pass. The initial harness used an unsuitable absolute module path; the follow-up changes only its invocation directory.
  • macOS Clang ASan/UBSan: regression controls, C API tests and all 119 relevant cases pass. Full test262 retains the same 40 known failures across 82,220 tests on both revisions, with expectations unchanged.

Known baseline failure: the full sanitizer local suite has the same test_std.js second-pipe-handler assertion on both revisions, on Linux and macOS. Its runner exits zero despite that assertion; the counts and diagnostics were checked directly. The new regression passes under sanitizers. Full Windows test262 and full Linux sanitizer test262 were not run.

Implemented and tested with Codex assistance.

Check matchAll's global flag before looking up Symbol.matchAll. Use
RegExpCreate semantics for fallback matching instead of the RegExp
constructor, avoiding extra Symbol.match and source lookups.

Add regressions for observable getter order, pattern conversion, custom
matchers and exception cleanup.
@trestoncuzzort
trestoncuzzort marked this pull request as ready for review October 26, 2026 15:43

This branch has not been deployed

No deployments
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.

String.prototype.matchAll reads %Symbol.matchAll% before IsRegExp, and match/matchAll/search re-read %Symbol.match%

1 participant