Skip to content

[4.0][Parse] Fix skipping string interpolation in Lexer #10699

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

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jun 29, 2017

Cherry-pick #10246

  • Explanation: This is a fix for AcceptsInvalid case in Swift4 new feature.
    • Disallow newline after multiline string in string interpolation. (SR-5171)

      "abc\("""
            defg
            """ // ← This newline should be rejected.
            )hij"
    • Allow unbalanced " in multiline string in string interpolation.

      "abc\("""
            "defg ← This unbalanced quote should be accepted
            """)hij"
  • Scope: Affects lexing multiline string in string interpolation.
  • SR Issue: SR-5171
  • Risk: Low
  • Testing: Added regression tests

Maintain inner most string literal mode to determine whether we allow
newline character or not.

* Disallow newline after multiline string in string interpolation. (SR-5171)
* Allow unbalanced `"` in multiline string in string interpolation.
@rintaro
Copy link
Member Author

rintaro commented Jun 29, 2017

@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Jun 29, 2017

@milseman It this good for 4.0?

@rintaro rintaro changed the title [Parse] Fix skipping string interpolation in Lexer [4.0][Parse] Fix skipping string interpolation in Lexer Jun 29, 2017
@rintaro rintaro added this to the Swift 4.0 milestone Jun 29, 2017
@rintaro rintaro requested a review from milseman June 29, 2017 07:43
Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

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

LGTM

@tkremenek tkremenek merged commit 6ce8474 into swiftlang:swift-4.0-branch Jun 29, 2017
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