Skip to content

Fix removeBackslash message to display backslash correctly #2826

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

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftParserTest/ExpressionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: #"""
Expand Down
41 changes: 10 additions & 31 deletions Tests/SwiftParserTest/translated/MultilineErrorsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: #"""
Expand All @@ -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: #"""
Expand All @@ -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: #"""
Expand All @@ -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: #"""
Expand All @@ -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
"""
"""#
)
}
Comment on lines -713 to -731
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed it as it was completely redundant with testMultilineErrors24.


func testMultilineErrors26() {
assertParseWithAllNewlineEndings(
##"""
_ = ℹ️"""
Expand All @@ -756,7 +735,7 @@ final class MultilineErrorsTests: ParserTestCase {
)
}

func testMultilineErrors28() {
func testMultilineErrors26() {
assertParseWithAllNewlineEndings(
#"""
_ = """
Expand All @@ -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: #"""
Expand All @@ -777,7 +756,7 @@ final class MultilineErrorsTests: ParserTestCase {
)
}

func testMultilineErrors29() {
func testMultilineErrors27() {
assertParseWithAllNewlineEndings(
#"""
_ = """1️⃣\
Expand All @@ -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: #"""
Expand All @@ -802,7 +781,7 @@ final class MultilineErrorsTests: ParserTestCase {
)
}

func testMultilineErrors30() {
func testMultilineErrors28() {
assertParseWithAllNewlineEndings(
##"""
let _ = """
Expand Down Expand Up @@ -839,7 +818,7 @@ final class MultilineErrorsTests: ParserTestCase {
)
}

func testMultilineErrors31() {
func testMultilineErrors29() {
assertParseWithAllNewlineEndings(
##"""
let _ = """
Expand Down