@@ -1516,9 +1516,14 @@ final class RecoveryTests: XCTestCase {
1516
1516
class WrongInheritanceClause11️⃣(Int) {}
1517
1517
""" ,
1518
1518
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
+ """
1522
1527
)
1523
1528
}
1524
1529
@@ -1528,9 +1533,14 @@ final class RecoveryTests: XCTestCase {
1528
1533
class WrongInheritanceClause21️⃣(Base2<Int>) {}
1529
1534
""" ,
1530
1535
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
+ """
1534
1544
)
1535
1545
}
1536
1546
@@ -1540,9 +1550,14 @@ final class RecoveryTests: XCTestCase {
1540
1550
class WrongInheritanceClause3<T>1️⃣(SubModule.Base1) where T:AnyObject {}
1541
1551
""" ,
1542
1552
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
+ """
1546
1561
)
1547
1562
}
1548
1563
@@ -1552,9 +1567,14 @@ final class RecoveryTests: XCTestCase {
1552
1567
class WrongInheritanceClause41️⃣(SubModule.Base2<Int>) {}
1553
1568
""" ,
1554
1569
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
+ """
1558
1578
)
1559
1579
}
1560
1580
@@ -1564,47 +1584,55 @@ final class RecoveryTests: XCTestCase {
1564
1584
class WrongInheritanceClause5<T>1️⃣(SubModule.Base2<Int>) where T:AnyObject {}
1565
1585
""" ,
1566
1586
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
+ """
1570
1595
)
1571
1596
}
1572
1597
1573
1598
func testRecovery130( ) {
1574
1599
assertParse (
1575
1600
"""
1576
- class WrongInheritanceClause61️⃣(Int 2️⃣{}3️⃣
1601
+ class WrongInheritanceClause61️⃣(Int {}
1577
1602
""" ,
1578
1603
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
+ """
1585
1612
)
1586
1613
}
1587
1614
1588
1615
func testRecovery131( ) {
1589
1616
assertParse (
1590
1617
"""
1591
- class WrongInheritanceClause7<T>1️⃣(Int 2️⃣where T:AnyObject {}
1618
+ class WrongInheritanceClause7<T>1️⃣(Int where T:AnyObject {}
1592
1619
""" ,
1593
1620
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
+ """
1601
1629
)
1602
1630
}
1603
1631
1604
1632
func testRecovery132( ) {
1633
+ // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
1605
1634
assertParse (
1606
1635
"""
1607
- // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
1608
1636
Base=1 as Base=1
1609
1637
"""
1610
1638
)
0 commit comments