Skip to content

Commit c62591a

Browse files
committed
address review comment
1 parent a344469 commit c62591a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,9 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
630630
message: { _ in .typeParameterPackEllipsis }
631631
)
632632
} else if let unexpected = node.unexpectedBetweenNameAndColon,
633-
let unexpectedEllipsis = unexpected.onlyToken(where: { $0.tokenKind == .ellipsis }) {
633+
let unexpectedEllipsis = unexpected.onlyToken(where: { $0.tokenKind == .ellipsis }),
634+
let each = node.each
635+
{
634636
addDiagnostic(
635637
unexpected,
636638
.typeParameterPackEllipsis,
@@ -639,11 +641,11 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
639641
message: ReplaceTokensFixIt(replaceTokens: [unexpectedEllipsis], replacement: .keyword(.each)),
640642
changes: [
641643
.makeMissing(unexpected),
642-
.makePresent(node.each!, trailingTrivia: .space)
644+
.makePresent(each, trailingTrivia: .space),
643645
]
644646
)
645647
],
646-
handledNodes: [unexpected.id, node.each!.id]
648+
handledNodes: [unexpected.id, each.id]
647649
)
648650
}
649651
if let inheritedTypeName = node.inheritedType?.as(SimpleTypeIdentifierSyntax.self)?.name {

0 commit comments

Comments
 (0)