Skip to content

Conversation

@balajirrao
Copy link
Contributor

@balajirrao balajirrao commented Feb 13, 2025

The behaviour of NativeRegExp's exec with the sticky flag on was broken in cases where the regular expression does not start with a literal.

This fix doesn't fix any previously failing test262 tests. It seems that this test test/built-ins/RegExp/prototype/exec/y-fail-lastindex.js is the one expected to cover the feature. However this test has always passed since the behaviour of sticky in these "simple" cases are handled as special case.

The behaviour of NativeRegExp's exec with the sticky flag on was broken
in cases where the regular expression does not start with a literal. This
explains why the test262 https://github.com/tc39/test262/blob/main/test/built-ins/RegExp/prototype/exec/y-fail-lastindex.js
test passed.
@gbrail
Copy link
Collaborator

gbrail commented Feb 16, 2025

Looks good to me. Does this really not fix any test262 tests that were failing before? It seems like there should be some coverage for this feature in a standard test suite that we can use too.

@balajirrao
Copy link
Contributor Author

balajirrao commented Feb 18, 2025

@gbrail thanks for taking a look. I realised the PR description needed some work - I've improved it now.

It seems to me that Test262 isn’t meant to be exhaustive, and that the test built-ins/RegExp/prototype/exec/y-fail-lastindex.js is intended to cover the feature (though the test itself could be improved with better assertions). I’m still getting familiar with how this works, so I’d really appreciate any insights you might have.

@gbrail
Copy link
Collaborator

gbrail commented Feb 19, 2025

This also looks good, and thanks again. And this will probably require that you rebase your other PR!

@gbrail gbrail merged commit 55e9083 into mozilla:master Feb 19, 2025
3 checks passed
@balajirrao balajirrao deleted the fix-regex-sticky branch February 19, 2025 06:34
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.

2 participants