Skip to content

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