Skip to content

Commit c20084a

Browse files
committed
Fix compilation errors after rebase
1 parent 6a2c006 commit c20084a

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,28 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
813813
if shouldSkip(node) {
814814
return .skipChildren
815815
}
816+
if let singleQuote = node.unexpectedBetweenOpenDelimiterAndOpenQuote?.onlyToken(where: { $0.tokenKind == .singleQuote }) {
817+
let fixIt = FixIt(
818+
message: ReplaceTokensFixIt(replaceTokens: [singleQuote], replacement: node.openQuote),
819+
changes: [
820+
.makeMissing(singleQuote, transferTrivia: false),
821+
.makePresent(node.openQuote, leadingTrivia: singleQuote.leadingTrivia ?? []),
822+
.makeMissing(node.unexpectedBetweenSegmentsAndCloseQuote, transferTrivia: false),
823+
.makePresent(node.closeQuote, trailingTrivia: node.unexpectedBetweenSegmentsAndCloseQuote?.trailingTrivia ?? []),
824+
]
825+
)
826+
addDiagnostic(
827+
singleQuote,
828+
.singleQuoteStringLiteral,
829+
fixIts: [fixIt],
830+
handledNodes: [
831+
node.unexpectedBetweenOpenDelimiterAndOpenQuote?.id,
832+
node.openQuote.id,
833+
node.unexpectedBetweenSegmentsAndCloseQuote?.id,
834+
node.closeQuote.id,
835+
].compactMap { $0 }
836+
)
837+
}
816838
for (diagnostic, handledNodes) in MultiLineStringLiteralIndentatinDiagnosticsGenerator.diagnose(node) {
817839
addDiagnostic(diagnostic, handledNodes: handledNodes)
818840
}
@@ -870,37 +892,6 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
870892
return .visitChildren
871893
}
872894

873-
public override func visit(_ node: StringLiteralExprSyntax) -> SyntaxVisitorContinueKind {
874-
if shouldSkip(node) {
875-
return .skipChildren
876-
}
877-
878-
if let singleQuote = node.unexpectedBetweenOpenDelimiterAndOpenQuote?.onlyToken(where: { $0.tokenKind == .singleQuote }) {
879-
let fixIt = FixIt(
880-
message: ReplaceTokensFixIt(replaceTokens: [singleQuote], replacement: node.openQuote),
881-
changes: [
882-
.makeMissing(singleQuote, transferTrivia: false),
883-
.makePresent(node.openQuote, leadingTrivia: singleQuote.leadingTrivia ?? []),
884-
.makeMissing(node.unexpectedBetweenSegmentsAndCloseQuote, transferTrivia: false),
885-
.makePresent(node.closeQuote, trailingTrivia: node.unexpectedBetweenSegmentsAndCloseQuote?.trailingTrivia ?? []),
886-
]
887-
)
888-
addDiagnostic(
889-
singleQuote,
890-
.singleQuoteStringLiteral,
891-
fixIts: [fixIt],
892-
handledNodes: [
893-
node.unexpectedBetweenOpenDelimiterAndOpenQuote?.id,
894-
node.openQuote.id,
895-
node.unexpectedBetweenSegmentsAndCloseQuote?.id,
896-
node.closeQuote.id,
897-
].compactMap { $0 }
898-
)
899-
}
900-
901-
return .visitChildren
902-
}
903-
904895
public override func visit(_ node: SwitchCaseSyntax) -> SyntaxVisitorContinueKind {
905896
if shouldSkip(node) {
906897
return .skipChildren

Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public struct StaticParserNote: NoteMessage {
415415
extension NoteMessage where Self == StaticParserNote {
416416
/// Please order alphabetically by property name.
417417
public static var shouldMatchIndentationOfClosingQuote: Self {
418-
.init("should match indentation here"
418+
.init("should match indentation here")
419419
}
420420
}
421421

0 commit comments

Comments
 (0)