File tree Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ extension Parser {
333
333
}
334
334
335
335
mutating func parsePrimaryAssociatedTypes( ) -> RawPrimaryAssociatedTypeClauseSyntax {
336
- let langle = self . consumeAnyToken ( remapping : . leftAngle)
336
+ let langle = self . consumePrefix ( " < " , as : . leftAngle)
337
337
var associatedTypes = [ RawPrimaryAssociatedTypeSyntax] ( )
338
338
do {
339
339
var keepGoing : RawTokenSyntax ? = nil
Original file line number Diff line number Diff line change @@ -560,6 +560,8 @@ fileprivate func assertRoundTrip<S: SyntaxProtocol>(
560
560
// the mutated source and that it round-trips
561
561
var mutatedParser = Parser ( buf)
562
562
let mutatedTree = parse ( & mutatedParser)
563
+ // Run the diagnostic generator to make sure it doesn’t crash
564
+ _ = ParseDiagnosticsGenerator . diagnostics ( for: mutatedTree)
563
565
assertStringsEqualWithDiff (
564
566
" \( mutatedTree) " ,
565
567
mutatedSource,
Original file line number Diff line number Diff line change @@ -2222,4 +2222,14 @@ final class DeclarationTests: XCTestCase {
2222
2222
"""
2223
2223
)
2224
2224
}
2225
+
2226
+ func testEmptyPrimaryAssociatedType( ) {
2227
+ assertParse (
2228
+ " protocol X<1️⃣> {} " ,
2229
+ diagnostics: [
2230
+ DiagnosticSpec ( message: " expected name in primary associated type clause " , fixIts: [ " insert name " ] )
2231
+ ] ,
2232
+ fixedSource: " protocol X<<#identifier#>> {} "
2233
+ )
2234
+ }
2225
2235
}
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ final class StatementTests: XCTestCase {
96
96
}
97
97
98
98
func testNestedIfs( ) {
99
- let nest = 20
99
+ let nest = 10
100
100
var source = " func nestThoseIfs() { \n "
101
101
for index in ( 0 ... nest) {
102
102
let indent = String ( repeating: " " , count: index + 1 )
You can’t perform that action at this time.
0 commit comments