File tree Expand file tree Collapse file tree 5 files changed +7
-39
lines changed
Tests/SwiftParserTest/translated Expand file tree Collapse file tree 5 files changed +7
-39
lines changed Original file line number Diff line number Diff line change @@ -1025,7 +1025,7 @@ extension Parser {
1025
1025
// the token is a operator starts with '.', or the following token is '['.
1026
1026
let rootType : RawTypeSyntax ?
1027
1027
if !self . currentToken. starts ( with: " . " ) {
1028
- rootType = self . parseSimpleType ( stopAtFirstPeriod: true , isRawKeyPathExprSyntax : true )
1028
+ rootType = self . parseSimpleType ( stopAtFirstPeriod: true )
1029
1029
} else {
1030
1030
rootType = nil
1031
1031
}
Original file line number Diff line number Diff line change @@ -236,23 +236,13 @@ extension Parser {
236
236
/// member-type-identifier-base → simple-type | member-type-identifier
237
237
@_spi ( RawSyntax)
238
238
public mutating func parseSimpleType(
239
- stopAtFirstPeriod: Bool = false ,
240
- isRawKeyPathExprSyntax: Bool = false
239
+ stopAtFirstPeriod: Bool = false
241
240
) -> RawTypeSyntax {
242
241
var base : RawTypeSyntax
243
242
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
- }
254
243
case TokenSpec ( . Self) ,
255
- TokenSpec ( . Any) :
244
+ TokenSpec ( . Any) ,
245
+ TokenSpec ( . identifier) :
256
246
base = self . parseTypeIdentifier ( )
257
247
case TokenSpec ( . leftParen) :
258
248
base = RawTypeSyntax ( self . parseTupleTypeBody ( ) )
Original file line number Diff line number Diff line change @@ -391,22 +391,6 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
391
391
}
392
392
393
393
// 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
- }
410
394
411
395
public override func visit( _ node: ArrowExprSyntax ) -> SyntaxVisitorContinueKind {
412
396
if shouldSkip ( node) {
Original file line number Diff line number Diff line change @@ -89,9 +89,6 @@ extension DiagnosticMessage where Self == StaticParserError {
89
89
public static var allStatmentsInSwitchMustBeCoveredByCase : Self {
90
90
. init( " all statements inside a switch must be covered by a 'case' or 'default' label " )
91
91
}
92
- public static var arrayTypesAreWrittenWithTheBracketsAround : Self {
93
- . init( " array types are now written with the brackets around the element type " )
94
- }
95
92
public static var associatedTypeCannotUsePack : Self {
96
93
. init( " associated types cannot be variadic " )
97
94
}
Original file line number Diff line number Diff line change @@ -1273,8 +1273,7 @@ final class RecoveryTests: XCTestCase {
1273
1273
}
1274
1274
""" ,
1275
1275
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 " )
1278
1277
]
1279
1278
)
1280
1279
}
@@ -1289,8 +1288,7 @@ final class RecoveryTests: XCTestCase {
1289
1288
}
1290
1289
""" ,
1291
1290
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 " )
1294
1292
]
1295
1293
)
1296
1294
}
@@ -1305,8 +1303,7 @@ final class RecoveryTests: XCTestCase {
1305
1303
}
1306
1304
""" ,
1307
1305
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 " )
1310
1307
]
1311
1308
)
1312
1309
}
You can’t perform that action at this time.
0 commit comments