Repository: swiftlang/swift-syntax (swift)

Issue:
Improperly escaped backslash in fix-it message
### Issue Kind

Bad Diagnostic Produced

### Source Code

```swift
"""
foo \
"""
```

### Description

The following fix-it message contains an improperly escaped backslash.

```swift
extension FixItMessage where Self == StaticParserFixIt {
  ...
  public static var removeBackslash: Self {
    .init("remove '\'")
  }
  ...
}
```

This results in bad diagnostic produced, e.g.

```swift
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
        """
      """#
  )
}
```

Pull request description:
Resolve #2743

Patch:
diff --git a/Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift b/Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift
index 2a1b2a02c40..f1a21255bb5 100644
--- a/Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift
+++ b/Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift
@@ -671,7 +671,7 @@ extension FixItMessage where Self == StaticParserFixIt {
     .init("join the identifiers together with camel-case")
   }
   public static var removeBackslash: Self {
-    .init("remove '\'")
+    .init(#"remove '\'"#)
   }
   public static var removeExtraneousDelimiters: Self {
     .init("remove extraneous delimiters")


Test patch:
diff --git a/Tests/SwiftParserTest/ExpressionTests.swift b/Tests/SwiftParserTest/ExpressionTests.swift
index f5b2f9e0454..e05f97073d4 100644
--- a/Tests/SwiftParserTest/ExpressionTests.swift
+++ b/Tests/SwiftParserTest/ExpressionTests.swift
@@ -1312,7 +1312,7 @@ final class ExpressionTests: ParserTestCase {
       diagnostics: [
         DiagnosticSpec(
           message: "escaped newline at the last line of a multi-line string literal is not allowed",
-          fixIts: ["remove ''"]
+          fixIts: [#"remove '\'"#]
         )
       ],
       fixedSource: #"""
diff --git a/Tests/SwiftParserTest/translated/MultilineErrorsTests.swift b/Tests/SwiftParserTest/translated/MultilineErrorsTests.swift
index ce4704f1798..e9f57e14bac 100644
--- a/Tests/SwiftParserTest/translated/MultilineErrorsTests.swift
+++ b/Tests/SwiftParserTest/translated/MultilineErrorsTests.swift
@@ -634,7 +634,7 @@ final class MultilineErrorsTests: ParserTestCase {
       diagnostics: [
         DiagnosticSpec(
           message: "escaped newline at the last line of a multi-line string literal is not allowed",
-          fixIts: ["remove '\'"]
+          fixIts: [#"remove '\'"#]
         )
       ],
       fixedSource: #"""
@@ -656,7 +656,7 @@ final class MultilineErrorsTests: ParserTestCase {
       diagnostics: [
         DiagnosticSpec(
           message: "escaped newline at the last line of a multi-line string literal is not allowed",
-          fixIts: ["remove ''"]
+          fixIts: [#"remove '\'"#]
         )
       ],
       fixedSource: #"""
@@ -677,7 +677,7 @@ final class MultilineErrorsTests: ParserTestCase {
       diagnostics: [
         DiagnosticSpec(
           message: "escaped newline at the last line of a multi-line string literal is not allowed",
-          fixIts: ["remove ''"]
+          fixIts: [#"remove '\'"#]
         )
       ],
       fixedSource: #"""
@@ -698,7 +698,7 @@ final class MultilineErrorsTests: ParserTestCase {
       diagnostics: [
         DiagnosticSpec(
           message: "escaped newline at the last line of a multi-line string literal is not allowed",
-          fixIts: ["remove ''"]
+          fixIts: [#"remove '\'"#]
         )
       ],
       fixedSource: #"""
@@ -710,27 +710,6 @@ final class MultilineErrorsTests: ParserTestCase {
   }
 
   func testMultilineErrors25() {
-    assertParseWithAllNewlineEndings(
-      #"""
-      _ = """
-        foo1️⃣\
-        """
-      """#,
-      diagnostics: [
-        DiagnosticSpec(
-          message: "escaped newline at the last line of a multi-line string literal is not allowed",
-          fixIts: ["remove ''"]
-        )
-      ],
-      fixedSource: #"""
-        _ = """
-          foo
-          """
-        """#
-    )
-  }
-
-  func testMultilineErrors26() {
     assertParseWithAllNewlineEndings(
       ##"""
       _ = ℹ️"""
@@ -756,7 +735,7 @@ final class MultilineErrorsTests: ParserTestCase {
     )
   }
 
-  func testMultilineErrors28() {
+  func testMultilineErrors26() {
     assertParseWithAllNewlineEndings(
       #"""
       _ = """
@@ -766,7 +745,7 @@ final class MultilineErrorsTests: ParserTestCase {
       diagnostics: [
         DiagnosticSpec(
           message: "escaped newline at the last line of a multi-line string literal is not allowed",
-          fixIts: ["remove ''"]
+          fixIts: [#"remove '\'"#]
         )
       ],
       fixedSource: #"""
@@ -777,7 +756,7 @@ final class MultilineErrorsTests: ParserTestCase {
     )
   }
 
-  func testMultilineErrors29() {
+  func testMultilineErrors27() {
     assertParseWithAllNewlineEndings(
       #"""
       _ = """1️⃣\
@@ -790,7 +769,7 @@ final class MultilineErrorsTests: ParserTestCase {
         ),
         DiagnosticSpec(
           message: "escaped newline at the last line of a multi-line string literal is not allowed",
-          fixIts: ["remove ''"]
+          fixIts: [#"remove '\'"#]
         ),
       ],
       fixedSource: #"""
@@ -802,7 +781,7 @@ final class MultilineErrorsTests: ParserTestCase {
     )
   }
 
-  func testMultilineErrors30() {
+  func testMultilineErrors28() {
     assertParseWithAllNewlineEndings(
       ##"""
       let _ = """
@@ -839,7 +818,7 @@ final class MultilineErrorsTests: ParserTestCase {
     )
   }
 
-  func testMultilineErrors31() {
+  func testMultilineErrors29() {
     assertParseWithAllNewlineEndings(
       ##"""
       let _ = """