Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix negative lookaround stack handling #99424

Merged
merged 3 commits into from
Mar 12, 2024

Conversation

stephentoub
Copy link
Member

If the body of negative lookaround inside of a loop and containing a capture ends up successfully matching (which means the negative lookaround fails to match), it ends up erroneously leaving a position on the backtracking stack. This fix ensures that state is popped.

This snuck in while outerloop tests weren't reporting failures (fixed recently). Upon re-enabling the test, the problem was also flagged by diagnostics added in #98472.

If the body of negative lookaround inside of a loop and containing a capture ends up successfully matching (which means the negative lookaround fails to match), it ends up erroneously leaving a position on the backtracking stack. This fix ensures that state is popped.
@danmoseley
Copy link
Member

danmoseley commented Mar 11, 2024

the test that found this -- should it be / is it possible to make it inner loop?

edit: oh, I see the test. is it possible to make a test for this specific case that's inner loop?

Copy link
Member

@danmoseley danmoseley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is interpreter unaffected?

@stephentoub
Copy link
Member Author

is interpreter unaffected?

Yes

is it possible to make a test for this specific case that's inner loop?

Sure, added.

@stephentoub stephentoub merged commit 27214a0 into dotnet:main Mar 12, 2024
111 checks passed
@stephentoub stephentoub deleted the fixlookaroundstack branch March 12, 2024 01:52
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants