@@ -1551,9 +1551,14 @@ final class RecoveryTests: XCTestCase {
1551
1551
class WrongInheritanceClause11️⃣(Int) {}
1552
1552
""" ,
1553
1553
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
+ """
1557
1562
)
1558
1563
}
1559
1564
@@ -1563,9 +1568,14 @@ final class RecoveryTests: XCTestCase {
1563
1568
class WrongInheritanceClause21️⃣(Base2<Int>) {}
1564
1569
""" ,
1565
1570
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
+ """
1569
1579
)
1570
1580
}
1571
1581
@@ -1575,9 +1585,14 @@ final class RecoveryTests: XCTestCase {
1575
1585
class WrongInheritanceClause3<T>1️⃣(SubModule.Base1) where T:AnyObject {}
1576
1586
""" ,
1577
1587
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
+ """
1581
1596
)
1582
1597
}
1583
1598
@@ -1587,9 +1602,14 @@ final class RecoveryTests: XCTestCase {
1587
1602
class WrongInheritanceClause41️⃣(SubModule.Base2<Int>) {}
1588
1603
""" ,
1589
1604
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
+ """
1593
1613
)
1594
1614
}
1595
1615
@@ -1599,47 +1619,55 @@ final class RecoveryTests: XCTestCase {
1599
1619
class WrongInheritanceClause5<T>1️⃣(SubModule.Base2<Int>) where T:AnyObject {}
1600
1620
""" ,
1601
1621
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
+ """
1605
1630
)
1606
1631
}
1607
1632
1608
1633
func testRecovery130( ) {
1609
1634
assertParse (
1610
1635
"""
1611
- class WrongInheritanceClause61️⃣(Int 2️⃣{}3️⃣
1636
+ class WrongInheritanceClause61️⃣(Int {}
1612
1637
""" ,
1613
1638
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
+ """
1620
1647
)
1621
1648
}
1622
1649
1623
1650
func testRecovery131( ) {
1624
1651
assertParse (
1625
1652
"""
1626
- class WrongInheritanceClause7<T>1️⃣(Int 2️⃣where T:AnyObject {}
1653
+ class WrongInheritanceClause7<T>1️⃣(Int where T:AnyObject {}
1627
1654
""" ,
1628
1655
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
+ """
1636
1664
)
1637
1665
}
1638
1666
1639
1667
func testRecovery132( ) {
1668
+ // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
1640
1669
assertParse (
1641
1670
"""
1642
- // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
1643
1671
Base=1 as Base=1
1644
1672
"""
1645
1673
)
0 commit comments