Skip to content

Conversation

@hamishknight
Copy link
Contributor

There were a few cases where we could parse tokens that had leading trivia, causing us to incorrectly accept some single-line string literals that spanned multiple lines. Fix up these cases to ensure the tokens we parse don't have leading trivia.

When parsing the end of an interpolation segment,
even if there is a closing `)` present, the lexer
may still think it's inside a nested position in
an interpolated segment. As such, make sure to
always tell it to move back to string literal
mode for better diagnostics.
We were missing a check for multi-line literals
here.
There were a few cases where we could parse tokens
that had leading trivia, causing us to incorrectly
accept some single-line string literals that
spanned multiple lines. Fix up these cases to
ensure the tokens we parse don't have leading
trivia.
@hamishknight hamishknight requested a review from ahoppen as a code owner March 17, 2023 18:29
@hamishknight
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thank you 🙏🏽

@hamishknight hamishknight merged commit 698525c into swiftlang:main Mar 20, 2023
@hamishknight hamishknight deleted the string-overflow branch March 20, 2023 15:26
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