@@ -1551,9 +1551,14 @@ final class RecoveryTests: XCTestCase {
15511551 class WrongInheritanceClause11️⃣(Int) {}
15521552 """ ,
15531553 diagnostics: [
1554- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 34 - 35 = ''
1555- DiagnosticSpec ( message: " unexpected code '(Int)' in class " )
1556- ]
1554+ DiagnosticSpec (
1555+ message: " expected ':' to begin inheritance clause " ,
1556+ fixIts: [ " replace '()' with ':' " ]
1557+ )
1558+ ] ,
1559+ fixedSource: """
1560+ class WrongInheritanceClause1: Int {}
1561+ """
15571562 )
15581563 }
15591564
@@ -1563,9 +1568,14 @@ final class RecoveryTests: XCTestCase {
15631568 class WrongInheritanceClause21️⃣(Base2<Int>) {}
15641569 """ ,
15651570 diagnostics: [
1566- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 41 - 42 = ''
1567- DiagnosticSpec ( message: " unexpected code '(Base2<Int>)' in class " )
1568- ]
1571+ DiagnosticSpec (
1572+ message: " expected ':' to begin inheritance clause " ,
1573+ fixIts: [ " replace '()' with ':' " ]
1574+ )
1575+ ] ,
1576+ fixedSource: """
1577+ class WrongInheritanceClause2: Base2<Int>{}
1578+ """
15691579 )
15701580 }
15711581
@@ -1575,9 +1585,14 @@ final class RecoveryTests: XCTestCase {
15751585 class WrongInheritanceClause3<T>1️⃣(SubModule.Base1) where T:AnyObject {}
15761586 """ ,
15771587 diagnostics: [
1578- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 49 - 50 = ''
1579- DiagnosticSpec ( message: " unexpected code '(SubModule.Base1) where T:AnyObject' in class " )
1580- ]
1588+ DiagnosticSpec (
1589+ message: " expected ':' to begin inheritance clause " ,
1590+ fixIts: [ " replace '()' with ':' " ]
1591+ )
1592+ ] ,
1593+ fixedSource: """
1594+ class WrongInheritanceClause3<T>: SubModule.Base1 where T:AnyObject {}
1595+ """
15811596 )
15821597 }
15831598
@@ -1587,9 +1602,14 @@ final class RecoveryTests: XCTestCase {
15871602 class WrongInheritanceClause41️⃣(SubModule.Base2<Int>) {}
15881603 """ ,
15891604 diagnostics: [
1590- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 51 - 52 = ''
1591- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>)' in class " )
1592- ]
1605+ DiagnosticSpec (
1606+ message: " expected ':' to begin inheritance clause " ,
1607+ fixIts: [ " replace '()' with ':' " ]
1608+ )
1609+ ] ,
1610+ fixedSource: """
1611+ class WrongInheritanceClause4: SubModule.Base2<Int>{}
1612+ """
15931613 )
15941614 }
15951615
@@ -1599,47 +1619,55 @@ final class RecoveryTests: XCTestCase {
15991619 class WrongInheritanceClause5<T>1️⃣(SubModule.Base2<Int>) where T:AnyObject {}
16001620 """ ,
16011621 diagnostics: [
1602- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 54 - 55 = ''
1603- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>) where T:AnyObject' in class " )
1604- ]
1622+ DiagnosticSpec (
1623+ message: " expected ':' to begin inheritance clause " ,
1624+ fixIts: [ " replace '()' with ':' " ]
1625+ )
1626+ ] ,
1627+ fixedSource: """
1628+ class WrongInheritanceClause5<T>: SubModule.Base2<Int>where T:AnyObject {}
1629+ """
16051630 )
16061631 }
16071632
16081633 func testRecovery130( ) {
16091634 assertParse (
16101635 """
1611- class WrongInheritanceClause61️⃣(Int 2️⃣{}3️⃣
1636+ class WrongInheritanceClause61️⃣(Int {}
16121637 """ ,
16131638 diagnostics: [
1614- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': '
1615- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " ) ,
1616- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " ) ,
1617- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " ) ,
1618- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " expected '}' to end class " ) ,
1619- ]
1639+ DiagnosticSpec (
1640+ message: " expected ':' to begin inheritance clause " ,
1641+ fixIts: [ " replace '(' with ':' " ]
1642+ )
1643+ ] ,
1644+ fixedSource: """
1645+ class WrongInheritanceClause6: Int {}
1646+ """
16201647 )
16211648 }
16221649
16231650 func testRecovery131( ) {
16241651 assertParse (
16251652 """
1626- class WrongInheritanceClause7<T>1️⃣(Int 2️⃣where T:AnyObject {}
1653+ class WrongInheritanceClause7<T>1️⃣(Int where T:AnyObject {}
16271654 """ ,
16281655 diagnostics: [
1629- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': '
1630- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " ) ,
1631- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " ) ,
1632- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " ) ,
1633- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected '}' to end class " ) ,
1634- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " extraneous code 'where T:AnyObject {}' at top level " ) ,
1635- ]
1656+ DiagnosticSpec (
1657+ message: " expected ':' to begin inheritance clause " ,
1658+ fixIts: [ " replace '(' with ':' " ]
1659+ )
1660+ ] ,
1661+ fixedSource: """
1662+ class WrongInheritanceClause7<T>: Int where T:AnyObject {}
1663+ """
16361664 )
16371665 }
16381666
16391667 func testRecovery132( ) {
1668+ // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
16401669 assertParse (
16411670 """
1642- // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
16431671 Base=1 as Base=1
16441672 """
16451673 )
0 commit comments