@@ -1518,9 +1518,11 @@ final class RecoveryTests: XCTestCase {
1518
1518
class WrongInheritanceClause11️⃣(Int) {}
1519
1519
""" ,
1520
1520
diagnostics: [
1521
- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 34 - 35 = ''
1522
- DiagnosticSpec ( message: " unexpected code '(Int)' in class " )
1523
- ]
1521
+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1522
+ ] ,
1523
+ fixedSource: """
1524
+ class WrongInheritanceClause1: Int {}
1525
+ """
1524
1526
)
1525
1527
}
1526
1528
@@ -1530,9 +1532,11 @@ final class RecoveryTests: XCTestCase {
1530
1532
class WrongInheritanceClause21️⃣(Base2<Int>) {}
1531
1533
""" ,
1532
1534
diagnostics: [
1533
- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 41 - 42 = ''
1534
- DiagnosticSpec ( message: " unexpected code '(Base2<Int>)' in class " )
1535
- ]
1535
+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1536
+ ] ,
1537
+ fixedSource: """
1538
+ class WrongInheritanceClause2: Base2<Int> {}
1539
+ """
1536
1540
)
1537
1541
}
1538
1542
@@ -1542,9 +1546,11 @@ final class RecoveryTests: XCTestCase {
1542
1546
class WrongInheritanceClause3<T>1️⃣(SubModule.Base1) where T:AnyObject {}
1543
1547
""" ,
1544
1548
diagnostics: [
1545
- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 49 - 50 = ''
1546
- DiagnosticSpec ( message: " unexpected code '(SubModule.Base1) where T:AnyObject' in class " )
1547
- ]
1549
+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1550
+ ] ,
1551
+ fixedSource: """
1552
+ class WrongInheritanceClause3<T>: SubModule.Base1 where T:AnyObject {}
1553
+ """
1548
1554
)
1549
1555
}
1550
1556
@@ -1554,9 +1560,11 @@ final class RecoveryTests: XCTestCase {
1554
1560
class WrongInheritanceClause41️⃣(SubModule.Base2<Int>) {}
1555
1561
""" ,
1556
1562
diagnostics: [
1557
- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': ', 51 - 52 = ''
1558
- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>)' in class " )
1559
- ]
1563
+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1564
+ ] ,
1565
+ fixedSource: """
1566
+ class WrongInheritanceClause4: SubModule.Base2<Int> {}
1567
+ """
1560
1568
)
1561
1569
}
1562
1570
@@ -1566,47 +1574,46 @@ final class RecoveryTests: XCTestCase {
1566
1574
class WrongInheritanceClause5<T>1️⃣(SubModule.Base2<Int>) where T:AnyObject {}
1567
1575
""" ,
1568
1576
diagnostics: [
1569
- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': ', 54 - 55 = ''
1570
- DiagnosticSpec ( message: " unexpected code '(SubModule.Base2<Int>) where T:AnyObject' in class " )
1571
- ]
1577
+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1578
+ ] ,
1579
+ fixedSource: """
1580
+ class WrongInheritanceClause5<T>: SubModule.Base2<Int> where T:AnyObject {}
1581
+ """
1572
1582
)
1573
1583
}
1574
1584
1575
1585
func testRecovery130( ) {
1576
1586
assertParse (
1577
1587
"""
1578
- class WrongInheritanceClause61️⃣(Int 2️⃣{}3️⃣
1588
+ class WrongInheritanceClause61️⃣(Int {}
1579
1589
""" ,
1580
1590
diagnostics: [
1581
- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 30 - 31 = ': '
1582
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " ) ,
1583
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " ) ,
1584
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " ) ,
1585
- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " expected '}' to end class " ) ,
1586
- ]
1591
+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1592
+ ] ,
1593
+ fixedSource: """
1594
+ class WrongInheritanceClause6: Int {}
1595
+ """
1587
1596
)
1588
1597
}
1589
1598
1590
1599
func testRecovery131( ) {
1591
1600
assertParse (
1592
1601
"""
1593
- class WrongInheritanceClause7<T>1️⃣(Int 2️⃣where T:AnyObject {}
1602
+ class WrongInheritanceClause7<T>1️⃣(Int where T:AnyObject {}
1594
1603
""" ,
1595
1604
diagnostics: [
1596
- // TODO: Old parser expected error on line 1: expected ':' to begin inheritance clause, Fix-It replacements: 33 - 34 = ': '
1597
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected '{' in class " ) ,
1598
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected 'var' in variable " ) ,
1599
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected ')' to end tuple pattern " ) ,
1600
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected '}' to end class " ) ,
1601
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " extraneous code 'where T:AnyObject {}' at top level " ) ,
1602
- ]
1605
+ DiagnosticSpec ( message: " expected ':' to begin inheritance clause " )
1606
+ ] ,
1607
+ fixedSource: """
1608
+ class WrongInheritanceClause7<T>: Int where T:AnyObject {}
1609
+ """
1603
1610
)
1604
1611
}
1605
1612
1606
1613
func testRecovery132( ) {
1614
+ // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
1607
1615
assertParse (
1608
1616
"""
1609
- // <rdar://problem/18502220> [swift-crashes 078] parser crash on invalid cast in sequence expr
1610
1617
Base=1 as Base=1
1611
1618
"""
1612
1619
)
@@ -2242,5 +2249,4 @@ final class RecoveryTests: XCTestCase {
2242
2249
]
2243
2250
)
2244
2251
}
2245
-
2246
2252
}
0 commit comments