@@ -1516,9 +1516,14 @@ final class RecoveryTests: XCTestCase {
15161516 class WrongInheritanceClause11️⃣(Int) {}
15171517 """ ,
15181518 diagnostics: [
1519- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 34 - 35 = ''
1520- DiagnosticSpec ( message: " unexpected code '(Int)' in class " )
1521- ]
1519+ DiagnosticSpec (
1520+ message: " expected ':' to begin inheritance clause " ,
1521+ fixIts: [ " replace '()' with ':' " ]
1522+ )
1523+ ] ,
1524+ fixedSource: """
1525+ class WrongInheritanceClause1: Int {}
1526+ """
15221527 )
15231528 }
15241529
@@ -1528,9 +1533,14 @@ final class RecoveryTests: XCTestCase {
15281533 class WrongInheritanceClause21️⃣(Base2<Int>) {}
15291534 """ ,
15301535 diagnostics: [
1531- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 41 - 42 = ''
1532- DiagnosticSpec ( message: " unexpected code '(Base2<Int>)' in class " )
1533- ]
1536+ DiagnosticSpec (
1537+ message: " expected ':' to begin inheritance clause " ,
1538+ fixIts: [ " replace '()' with ':' " ]
1539+ )
1540+ ] ,
1541+ fixedSource: """
1542+ class WrongInheritanceClause2: Base2<Int>{}
1543+ """
15341544 )
15351545 }
15361546
@@ -1540,9 +1550,14 @@ final class RecoveryTests: XCTestCase {
15401550 class WrongInheritanceClause3<T>1️⃣(SubModule.Base1) where T:AnyObject {}
15411551 """ ,
15421552 diagnostics: [
1543- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 49 - 50 = ''
1544- DiagnosticSpec ( message: " unexpected code '(SubModule.Base1) where T:AnyObject' in class " )
1545- ]
1553+ DiagnosticSpec (
1554+ message: " expected ':' to begin inheritance clause " ,
1555+ fixIts: [ " replace '()' with ':' " ]
1556+ )
1557+ ] ,
1558+ fixedSource: """
1559+ class WrongInheritanceClause3<T>: SubModule.Base1 where T:AnyObject {}
1560+ """
15461561 )
15471562 }
15481563
@@ -1552,9 +1567,14 @@ final class RecoveryTests: XCTestCase {
15521567 class WrongInheritanceClause41️⃣(SubModule.Base2<Int>) {}
15531568 """ ,
15541569 diagnostics: [
1555- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 51 - 52 = ''
1556- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>)' in class " )
1557- ]
1570+ DiagnosticSpec (
1571+ message: " expected ':' to begin inheritance clause " ,
1572+ fixIts: [ " replace '()' with ':' " ]
1573+ )
1574+ ] ,
1575+ fixedSource: """
1576+ class WrongInheritanceClause4: SubModule.Base2<Int>{}
1577+ """
15581578 )
15591579 }
15601580
@@ -1564,47 +1584,55 @@ final class RecoveryTests: XCTestCase {
15641584 class WrongInheritanceClause5<T>1️⃣(SubModule.Base2<Int>) where T:AnyObject {}
15651585 """ ,
15661586 diagnostics: [
1567- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 54 - 55 = ''
1568- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>) where T:AnyObject' in class " )
1569- ]
1587+ DiagnosticSpec (
1588+ message: " expected ':' to begin inheritance clause " ,
1589+ fixIts: [ " replace '()' with ':' " ]
1590+ )
1591+ ] ,
1592+ fixedSource: """
1593+ class WrongInheritanceClause5<T>: SubModule.Base2<Int>where T:AnyObject {}
1594+ """
15701595 )
15711596 }
15721597
15731598 func testRecovery130( ) {
15741599 assertParse (
15751600 """
1576- class WrongInheritanceClause61️⃣(Int 2️⃣{}3️⃣
1601+ class WrongInheritanceClause61️⃣(Int {}
15771602 """ ,
15781603 diagnostics: [
1579- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': '
1580- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " ) ,
1581- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " ) ,
1582- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " ) ,
1583- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " expected '}' to end class " ) ,
1584- ]
1604+ DiagnosticSpec (
1605+ message: " expected ':' to begin inheritance clause " ,
1606+ fixIts: [ " replace '(' with ':' " ]
1607+ )
1608+ ] ,
1609+ fixedSource: """
1610+ class WrongInheritanceClause6: Int {}
1611+ """
15851612 )
15861613 }
15871614
15881615 func testRecovery131( ) {
15891616 assertParse (
15901617 """
1591- class WrongInheritanceClause7<T>1️⃣(Int 2️⃣where T:AnyObject {}
1618+ class WrongInheritanceClause7<T>1️⃣(Int where T:AnyObject {}
15921619 """ ,
15931620 diagnostics: [
1594- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': '
1595- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " ) ,
1596- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " ) ,
1597- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " ) ,
1598- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected '}' to end class " ) ,
1599- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " extraneous code 'where T:AnyObject {}' at top level " ) ,
1600- ]
1621+ DiagnosticSpec (
1622+ message: " expected ':' to begin inheritance clause " ,
1623+ fixIts: [ " replace '(' with ':' " ]
1624+ )
1625+ ] ,
1626+ fixedSource: """
1627+ class WrongInheritanceClause7<T>: Int where T:AnyObject {}
1628+ """
16011629 )
16021630 }
16031631
16041632 func testRecovery132( ) {
1633+ // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
16051634 assertParse (
16061635 """
1607- // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
16081636 Base=1 as Base=1
16091637 """
16101638 )
0 commit comments