matchAll/replaceAll: clearer wording for non-global RegExp TypeError - #207
Open
robobun wants to merge 1 commit into
Open
matchAll/replaceAll: clearer wording for non-global RegExp TypeError#207robobun wants to merge 1 commit into
robobun wants to merge 1 commit into
Conversation
This was referenced May 1, 2026
WalkthroughError messages for Changes
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
Comment |
robobun
pushed a commit
to oven-sh/bun
that referenced
this pull request
May 1, 2026
…essage describe.skipIf guards the whole block on a runtime probe of matchAll's TypeError, so CI stays green against the current prebuilt WebKit and the tests auto-activate once WEBKIT_VERSION is bumped to a build that includes oven-sh/WebKit#207.
robobun
pushed a commit
to oven-sh/bun
that referenced
this pull request
May 1, 2026
Pairs with oven-sh/WebKit#207 — asserts the new 'must contain the global (g) flag' wording on String.prototype.matchAll and replaceAll (including the DFG-tier replaceAll fast paths). Fixes #30023
robobun
pushed a commit
to oven-sh/bun
that referenced
this pull request
May 1, 2026
…essage describe.skipIf guards the whole block on a runtime probe of matchAll's TypeError, so CI stays green against the current prebuilt WebKit and the tests auto-activate once WEBKIT_VERSION is bumped to a build that includes oven-sh/WebKit#207.
Jarred-Sumner
pushed a commit
to oven-sh/bun
that referenced
this pull request
May 4, 2026
Pairs with oven-sh/WebKit#207 — asserts the new 'must contain the global (g) flag' wording on String.prototype.matchAll and replaceAll (including the DFG-tier replaceAll fast paths). Fixes #30023
Jarred-Sumner
pushed a commit
to oven-sh/bun
that referenced
this pull request
May 4, 2026
…essage describe.skipIf guards the whole block on a runtime probe of matchAll's TypeError, so CI stays green against the current prebuilt WebKit and the tests auto-activate once WEBKIT_VERSION is bumped to a build that includes oven-sh/WebKit#207.
Replaces String.prototype.matchAll argument must not be a non-global regular expression with String.prototype.matchAll argument must contain the global (g) flag The old wording's "must not be a non-global" double-negative is awkward. The new wording directly names the fix. Updates all seven call sites (matchAll + replaceAll, including the DFG paths) in runtime/StringPrototype.cpp and dfg/DFGOperations.cpp. Fixes oven-sh/bun#30023
robobun
force-pushed
the
farm/155dceec/matchall-error-message
branch
from
July 2, 2026 17:17
ff2d5b1 to
cec9fe4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the awkward double-negative
must not be a non-global regular expressionwithmust contain the global (g) flagin theTypeErrorthrown byString.prototype.matchAllandString.prototype.replaceAllwhen given a non-globalRegExp.Before
After
Call sites updated
Rebased onto the upstream WebKit upgrade (#263). That upgrade moved
matchAllout ofbuiltins/StringPrototype.js(which no longer exists) into C++, so the change now touches seven C++ call sites instead of the original five:Source/JavaScriptCore/runtime/StringPrototype.cpp-matchAllfast path +isRegExpslow pathSource/JavaScriptCore/runtime/StringPrototype.cpp-replaceAllfast path +isRegExpslow pathSource/JavaScriptCore/dfg/DFGOperations.cpp-replaceAllDFG paths (empty-replacement + two string-replacement operations)All seven emit identical wording per method.
Fixes oven-sh/bun#30023