File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -258,7 +258,12 @@ extension Parser {
258
258
arena: self . arena) )
259
259
} while keepGoing != nil && loopProgress. evaluate ( currentToken)
260
260
}
261
- let rangle = self . consumeAnyToken ( remapping: . rightAngle)
261
+ let rangle : RawTokenSyntax
262
+ if self . currentToken. starts ( with: " > " ) {
263
+ rangle = self . consumePrefix ( " > " , as: . rightAngle)
264
+ } else {
265
+ rangle = RawTokenSyntax ( missing: . rightAngle, arena: self . arena)
266
+ }
262
267
return RawPrimaryAssociatedTypeClauseSyntax (
263
268
leftAngleBracket: langle,
264
269
primaryAssociatedTypeList: RawPrimaryAssociatedTypeListSyntax ( elements: associatedTypes, arena: self . arena) ,
Original file line number Diff line number Diff line change @@ -1333,6 +1333,19 @@ final class DeclarationTests: XCTestCase {
1333
1333
]
1334
1334
)
1335
1335
}
1336
+
1337
+ func testPrimaryAssociatedTypeNotTerminatedWithAngleBracket( ) {
1338
+ AssertParse (
1339
+ " protocol1️⃣<2️⃣:3️⃣ " ,
1340
+ diagnostics: [
1341
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected identifier in protocol " ) ,
1342
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected name in primary associated type clause " ) ,
1343
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected '>' to end primary associated type clause " ) ,
1344
+ DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " expected type in type " ) ,
1345
+ DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " expected member block in protocol " ) ,
1346
+ ]
1347
+ )
1348
+ }
1336
1349
}
1337
1350
1338
1351
extension Parser . DeclAttributes {
You can’t perform that action at this time.
0 commit comments