Skip to content

Fix a false negative assertion failure in LoopProgressCondition for unterminated nested string interpolation #2543

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

Merged

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 15, 2024

If we have two nested, unterminated string interpolation segments, the lexer generates two empty stringLiteral tokens (one after each interpolation segment). When consuming the first empty string segment, we did actually make progress in the lexer by popping one nested string interpolation off the state stack. However, LoopProgressCondition did not consider this progress because it only looked at the top state in the state stack.

To fix this, consider the state stack size in LoopProgressCondition as well.

Fixes #2533
rdar://124168557

… unterminated nested string interpolation

If we have two nested, unterminated string interpolation segments, the lexer generates two empty `stringLiteral` tokens (one after each interpolation segment). When consuming the first empty string segment, we did actually make progress in the lexer by popping one nested string interpolation off the state stack. However, `LoopProgressCondition` did not consider this progress because it only looked at the top state in the state stack.

To fix this, consider the state stack size in `LoopProgressCondition` as well.

Fixes swiftlang#2533
rdar://124168557
@ahoppen ahoppen requested a review from bnbarham as a code owner March 15, 2024 16:30
@ahoppen
Copy link
Member Author

ahoppen commented Mar 15, 2024

@swift-ci Please test

@ahoppen ahoppen merged commit 18cd7f9 into swiftlang:main Mar 16, 2024
@ahoppen ahoppen deleted the ahoppen/loop-progress-condition-false-negative branch March 16, 2024 13:39
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.

Parser enters infinite loop in string parsing
2 participants