@@ -1521,9 +1521,14 @@ final class RecoveryTests: XCTestCase {
15211521 class WrongInheritanceClause11️⃣(Int) {}
15221522 """ ,
15231523 diagnostics: [
1524- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 34 - 35 = ''
1525- DiagnosticSpec ( message: " unexpected code '(Int)' in class " )
1526- ]
1524+ DiagnosticSpec (
1525+ message: " expected ':' to begin inheritance clause " ,
1526+ fixIts: [ " replace '()' with ':' " ]
1527+ )
1528+ ] ,
1529+ fixedSource: """
1530+ class WrongInheritanceClause1: Int {}
1531+ """
15271532 )
15281533 }
15291534
@@ -1533,9 +1538,14 @@ final class RecoveryTests: XCTestCase {
15331538 class WrongInheritanceClause21️⃣(Base2<Int>) {}
15341539 """ ,
15351540 diagnostics: [
1536- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 41 - 42 = ''
1537- DiagnosticSpec ( message: " unexpected code '(Base2<Int>)' in class " )
1538- ]
1541+ DiagnosticSpec (
1542+ message: " expected ':' to begin inheritance clause " ,
1543+ fixIts: [ " replace '()' with ':' " ]
1544+ )
1545+ ] ,
1546+ fixedSource: """
1547+ class WrongInheritanceClause2: Base2<Int>{}
1548+ """
15391549 )
15401550 }
15411551
@@ -1545,9 +1555,14 @@ final class RecoveryTests: XCTestCase {
15451555 class WrongInheritanceClause3<T>1️⃣(SubModule.Base1) where T:AnyObject {}
15461556 """ ,
15471557 diagnostics: [
1548- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 49 - 50 = ''
1549- DiagnosticSpec ( message: " unexpected code '(SubModule.Base1) where T:AnyObject' in class " )
1550- ]
1558+ DiagnosticSpec (
1559+ message: " expected ':' to begin inheritance clause " ,
1560+ fixIts: [ " replace '()' with ':' " ]
1561+ )
1562+ ] ,
1563+ fixedSource: """
1564+ class WrongInheritanceClause3<T>: SubModule.Base1 where T:AnyObject {}
1565+ """
15511566 )
15521567 }
15531568
@@ -1557,9 +1572,14 @@ final class RecoveryTests: XCTestCase {
15571572 class WrongInheritanceClause41️⃣(SubModule.Base2<Int>) {}
15581573 """ ,
15591574 diagnostics: [
1560- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 51 - 52 = ''
1561- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>)' in class " )
1562- ]
1575+ DiagnosticSpec (
1576+ message: " expected ':' to begin inheritance clause " ,
1577+ fixIts: [ " replace '()' with ':' " ]
1578+ )
1579+ ] ,
1580+ fixedSource: """
1581+ class WrongInheritanceClause4: SubModule.Base2<Int>{}
1582+ """
15631583 )
15641584 }
15651585
@@ -1569,47 +1589,55 @@ final class RecoveryTests: XCTestCase {
15691589 class WrongInheritanceClause5<T>1️⃣(SubModule.Base2<Int>) where T:AnyObject {}
15701590 """ ,
15711591 diagnostics: [
1572- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 54 - 55 = ''
1573- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>) where T:AnyObject' in class " )
1574- ]
1592+ DiagnosticSpec (
1593+ message: " expected ':' to begin inheritance clause " ,
1594+ fixIts: [ " replace '()' with ':' " ]
1595+ )
1596+ ] ,
1597+ fixedSource: """
1598+ class WrongInheritanceClause5<T>: SubModule.Base2<Int>where T:AnyObject {}
1599+ """
15751600 )
15761601 }
15771602
15781603 func testRecovery130( ) {
15791604 assertParse (
15801605 """
1581- class WrongInheritanceClause61️⃣(Int 2️⃣{}3️⃣
1606+ class WrongInheritanceClause61️⃣(Int {}
15821607 """ ,
15831608 diagnostics: [
1584- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': '
1585- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " , fixIts: [ " insert '{' " ] ) ,
1586- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " , fixIts: [ " insert 'var' " ] ) ,
1587- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " , fixIts: [ " insert ')' " ] ) ,
1588- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " expected '}' to end class " , fixIts: [ " insert '}' " ] ) ,
1589- ]
1609+ DiagnosticSpec (
1610+ message: " expected ':' to begin inheritance clause " ,
1611+ fixIts: [ " replace '(' with ':' " ]
1612+ )
1613+ ] ,
1614+ fixedSource: """
1615+ class WrongInheritanceClause6: Int {}
1616+ """
15901617 )
15911618 }
15921619
15931620 func testRecovery131( ) {
15941621 assertParse (
15951622 """
1596- class WrongInheritanceClause7<T>1️⃣(Int 2️⃣where T:AnyObject {}
1623+ class WrongInheritanceClause7<T>1️⃣(Int where T:AnyObject {}
15971624 """ ,
15981625 diagnostics: [
1599- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': '
1600- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " , fixIts: [ " insert '{' " ] ) ,
1601- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " , fixIts: [ " insert 'var' " ] ) ,
1602- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " , fixIts: [ " insert ')' " ] ) ,
1603- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected '}' to end class " , fixIts: [ " insert '}' " ] ) ,
1604- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " extraneous code 'where T:AnyObject {}' at top level " ) ,
1605- ]
1626+ DiagnosticSpec (
1627+ message: " expected ':' to begin inheritance clause " ,
1628+ fixIts: [ " replace '(' with ':' " ]
1629+ )
1630+ ] ,
1631+ fixedSource: """
1632+ class WrongInheritanceClause7<T>: Int where T:AnyObject {}
1633+ """
16061634 )
16071635 }
16081636
16091637 func testRecovery132( ) {
1638+ // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
16101639 assertParse (
16111640 """
1612- // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
16131641 Base=1 as Base=1
16141642 """
16151643 )
0 commit comments