Skip to content

Conversation

hamishknight
Copy link
Contributor

@hamishknight hamishknight commented Jun 18, 2025

6.2 cherry-pick of #3098

  • Explanation: Fixes a crash that could occur when an invalid string literal is used with #sourceLocation
  • Scope: Affects "simple" string literal parsing used for #sourceLocation/@available
  • Issue: rdar://152839292, Swift parser crashes on invalid multi-line string literal #3097
  • Risk: Low, only affects invalid code, and only affects "simple" string literals
  • Testing: Added tests to test suite
  • Reviewer: Hamish Knight

The only place where we were dropping unexpected tokens or trivia around a string segment was when inferring the indentation of the closing quote. Instead of having a precondition, add the conditions that the last segment doesn’t have any of these here and fall back to the same logic that is used when the indentaiton could not be inferred.

Fixes swiftlang#3097
@hamishknight hamishknight requested a review from bnbarham June 18, 2025 14:25
@hamishknight hamishknight requested a review from a team as a code owner June 18, 2025 14:25
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight merged commit e493ab9 into swiftlang:release/6.2 Jun 18, 2025
28 checks passed
@hamishknight hamishknight deleted the 3098-6.2 branch June 18, 2025 19: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.

3 participants