Skip to content

Commit 5ddde20

Browse files
committed
Removed TODOs
1 parent c8c4152 commit 5ddde20

File tree

5 files changed

+7
-39
lines changed

5 files changed

+7
-39
lines changed

Sources/SwiftParser/Expressions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ extension Parser {
10251025
// the token is a operator starts with '.', or the following token is '['.
10261026
let rootType: RawTypeSyntax?
10271027
if !self.currentToken.starts(with: ".") {
1028-
rootType = self.parseSimpleType(stopAtFirstPeriod: true, isRawKeyPathExprSyntax: true)
1028+
rootType = self.parseSimpleType(stopAtFirstPeriod: true)
10291029
} else {
10301030
rootType = nil
10311031
}

Sources/SwiftParser/Types.swift

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -236,23 +236,13 @@ extension Parser {
236236
/// member-type-identifier-base → simple-type | member-type-identifier
237237
@_spi(RawSyntax)
238238
public mutating func parseSimpleType(
239-
stopAtFirstPeriod: Bool = false,
240-
isRawKeyPathExprSyntax: Bool = false
239+
stopAtFirstPeriod: Bool = false
241240
) -> RawTypeSyntax {
242241
var base: RawTypeSyntax
243242
switch self.currentToken {
244-
case TokenSpec(.identifier):
245-
var lookahead = self.lookahead()
246-
lookahead.consumeAnyToken()
247-
if !isRawKeyPathExprSyntax,
248-
let _ = lookahead.consume(if: .leftSquareBracket, followedBy: .integerLiteral),
249-
lookahead.currentToken.rawTokenKind == .rightSquareBracket {
250-
base = RawTypeSyntax(self.parseCollectionType())
251-
} else {
252-
base = self.parseTypeIdentifier()
253-
}
254243
case TokenSpec(.Self),
255-
TokenSpec(.Any):
244+
TokenSpec(.Any),
245+
TokenSpec(.identifier):
256246
base = self.parseTypeIdentifier()
257247
case TokenSpec(.leftParen):
258248
base = RawTypeSyntax(self.parseTupleTypeBody())

Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -391,22 +391,6 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
391391
}
392392

393393
// MARK: - Specialized diagnostic generation
394-
395-
public override func visit(_ node: ArrayTypeSyntax) -> SyntaxVisitorContinueKind {
396-
if shouldSkip(node) {
397-
return .skipChildren
398-
}
399-
if let unexpectedIdentifier = node.unexpectedBeforeLeftSquareBracket,
400-
let unexpectedIntegerLiteral = node.unexpectedBetweenElementTypeAndRightSquareBracket,
401-
node.elementType.isMissingAllTokens {
402-
addDiagnostic(
403-
node.leftSquareBracket,
404-
.arrayTypesAreWrittenWithTheBracketsAround,
405-
handledNodes: [unexpectedIdentifier.id, unexpectedIntegerLiteral.id, node.elementType.id]
406-
)
407-
}
408-
return .visitChildren
409-
}
410394

411395
public override func visit(_ node: ArrowExprSyntax) -> SyntaxVisitorContinueKind {
412396
if shouldSkip(node) {

Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ extension DiagnosticMessage where Self == StaticParserError {
8989
public static var allStatmentsInSwitchMustBeCoveredByCase: Self {
9090
.init("all statements inside a switch must be covered by a 'case' or 'default' label")
9191
}
92-
public static var arrayTypesAreWrittenWithTheBracketsAround: Self {
93-
.init("array types are now written with the brackets around the element type")
94-
}
9592
public static var associatedTypeCannotUsePack: Self {
9693
.init("associated types cannot be variadic")
9794
}

Tests/SwiftParserTest/translated/RecoveryTests.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,8 +1273,7 @@ final class RecoveryTests: XCTestCase {
12731273
}
12741274
""",
12751275
diagnostics: [
1276-
// TODO: FixIt
1277-
DiagnosticSpec(message: "array types are now written with the brackets around the element type")
1276+
DiagnosticSpec(message: "unexpected code '[0]' in function")
12781277
]
12791278
)
12801279
}
@@ -1289,8 +1288,7 @@ final class RecoveryTests: XCTestCase {
12891288
}
12901289
""",
12911290
diagnostics: [
1292-
// TODO: FixIt
1293-
DiagnosticSpec(message: "array types are now written with the brackets around the element type")
1291+
DiagnosticSpec(message: "unexpected code '[0_1]' in function")
12941292
]
12951293
)
12961294
}
@@ -1305,8 +1303,7 @@ final class RecoveryTests: XCTestCase {
13051303
}
13061304
""",
13071305
diagnostics: [
1308-
// TODO: FixIt
1309-
DiagnosticSpec(message: "array types are now written with the brackets around the element type")
1306+
DiagnosticSpec(message: "unexpected code '[0b1]' in function")
13101307
]
13111308
)
13121309
}

0 commit comments

Comments
 (0)