Skip to content

Improperly escaped backslash in fix-it message #2743

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

Closed
AppAppWorks opened this issue Jul 19, 2024 · 1 comment · Fixed by #2826
Closed

Improperly escaped backslash in fix-it message #2743

AppAppWorks opened this issue Jul 19, 2024 · 1 comment · Fixed by #2826
Labels
bug Something isn't working SwiftParser Bugs in the (new) Parser written in Swift

Comments

@AppAppWorks
Copy link
Contributor

Issue Kind

Bad Diagnostic Produced

Source Code

"""
foo \
"""

Description

The following fix-it message contains an improperly escaped backslash.

extension FixItMessage where Self == StaticParserFixIt {
  ...
  public static var removeBackslash: Self {
    .init("remove '\'")
  }
  ...
}

This results in bad diagnostic produced, e.g.

func testMultilineErrors24() {
  assertParseWithAllNewlineEndings(
    #"""
    _ = """
      foo1️⃣\
      """
    """#,
    diagnostics: [
      DiagnosticSpec(
        message: "escaped newline at the last line of a multi-line string literal is not allowed",
        fixIts: ["remove ''"]
      )
    ],
    fixedSource: #"""
      _ = """
        foo
        """
      """#
  )
}
@AppAppWorks AppAppWorks added bug Something isn't working SwiftParser Bugs in the (new) Parser written in Swift labels Jul 19, 2024
@ahoppen
Copy link
Member

ahoppen commented Jul 19, 2024

Synced to Apple’s issue tracker as rdar://132054843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SwiftParser Bugs in the (new) Parser written in Swift
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants