@@ -1518,9 +1518,11 @@ final class RecoveryTests: XCTestCase {
15181518 class WrongInheritanceClause11️⃣(Int) {}
15191519 """ ,
15201520 diagnostics: [
1521- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 34 - 35 = ''
1522- DiagnosticSpec ( message: " unexpected code '(Int)' in class " )
1523- ]
1521+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1522+ ] ,
1523+ fixedSource: """
1524+ class WrongInheritanceClause1: Int {}
1525+ """
15241526 )
15251527 }
15261528
@@ -1530,9 +1532,11 @@ final class RecoveryTests: XCTestCase {
15301532 class WrongInheritanceClause21️⃣(Base2<Int>) {}
15311533 """ ,
15321534 diagnostics: [
1533- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 41 - 42 = ''
1534- DiagnosticSpec ( message: " unexpected code '(Base2<Int>)' in class " )
1535- ]
1535+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1536+ ] ,
1537+ fixedSource: """
1538+ class WrongInheritanceClause2: Base2<Int> {}
1539+ """
15361540 )
15371541 }
15381542
@@ -1542,9 +1546,11 @@ final class RecoveryTests: XCTestCase {
15421546 class WrongInheritanceClause3<T>1️⃣(SubModule.Base1) where T:AnyObject {}
15431547 """ ,
15441548 diagnostics: [
1545- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 49 - 50 = ''
1546- DiagnosticSpec ( message: " unexpected code '(SubModule.Base1) where T:AnyObject' in class " )
1547- ]
1549+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1550+ ] ,
1551+ fixedSource: """
1552+ class WrongInheritanceClause3<T>: SubModule.Base1 where T:AnyObject {}
1553+ """
15481554 )
15491555 }
15501556
@@ -1554,9 +1560,11 @@ final class RecoveryTests: XCTestCase {
15541560 class WrongInheritanceClause41️⃣(SubModule.Base2<Int>) {}
15551561 """ ,
15561562 diagnostics: [
1557- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 51 - 52 = ''
1558- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>)' in class " )
1559- ]
1563+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1564+ ] ,
1565+ fixedSource: """
1566+ class WrongInheritanceClause4: SubModule.Base2<Int> {}
1567+ """
15601568 )
15611569 }
15621570
@@ -1566,47 +1574,46 @@ final class RecoveryTests: XCTestCase {
15661574 class WrongInheritanceClause5<T>1️⃣(SubModule.Base2<Int>) where T:AnyObject {}
15671575 """ ,
15681576 diagnostics: [
1569- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 54 - 55 = ''
1570- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>) where T:AnyObject' in class " )
1571- ]
1577+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1578+ ] ,
1579+ fixedSource: """
1580+ class WrongInheritanceClause5<T>: SubModule.Base2<Int> where T:AnyObject {}
1581+ """
15721582 )
15731583 }
15741584
15751585 func testRecovery130( ) {
15761586 assertParse (
15771587 """
1578- class WrongInheritanceClause61️⃣(Int 2️⃣{}3️⃣
1588+ class WrongInheritanceClause61️⃣(Int {}
15791589 """ ,
15801590 diagnostics: [
1581- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': '
1582- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " ) ,
1583- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " ) ,
1584- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " ) ,
1585- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " expected '}' to end class " ) ,
1586- ]
1591+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1592+ ] ,
1593+ fixedSource: """
1594+ class WrongInheritanceClause6: Int {}
1595+ """
15871596 )
15881597 }
15891598
15901599 func testRecovery131( ) {
15911600 assertParse (
15921601 """
1593- class WrongInheritanceClause7<T>1️⃣(Int 2️⃣where T:AnyObject {}
1602+ class WrongInheritanceClause7<T>1️⃣(Int where T:AnyObject {}
15941603 """ ,
15951604 diagnostics: [
1596- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': '
1597- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " ) ,
1598- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " ) ,
1599- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " ) ,
1600- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected '}' to end class " ) ,
1601- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " extraneous code 'where T:AnyObject {}' at top level " ) ,
1602- ]
1605+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1606+ ] ,
1607+ fixedSource: """
1608+ class WrongInheritanceClause7<T>: Int where T:AnyObject {}
1609+ """
16031610 )
16041611 }
16051612
16061613 func testRecovery132( ) {
1614+ // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
16071615 assertParse (
16081616 """
1609- // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
16101617 Base=1 as Base=1
16111618 """
16121619 )
@@ -2242,5 +2249,4 @@ final class RecoveryTests: XCTestCase {
22422249 ]
22432250 )
22442251 }
2245-
22462252}
0 commit comments