File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -2253,6 +2253,9 @@ extension Parser {
2253
2253
} else if allowStandaloneStmtRecovery && ( self . atStartOfExpression ( ) || self . atStartOfStatement ( ) || self . atStartOfDeclaration ( ) ) {
2254
2254
// Synthesize a label for the stamenent or declaration that isn't coverd by a case right now.
2255
2255
let statements = parseSwitchCaseBody ( )
2256
+ if statements. isEmpty {
2257
+ break
2258
+ }
2256
2259
elements. append (
2257
2260
. switchCase(
2258
2261
RawSwitchCaseSyntax (
Original file line number Diff line number Diff line change @@ -1641,4 +1641,15 @@ final class StatementExpressionTests: XCTestCase {
1641
1641
]
1642
1642
)
1643
1643
}
1644
+
1645
+ func testStandaloneAtCaseInSwitch( ) {
1646
+ AssertParse (
1647
+ """
1648
+ switch x {
1649
+ 1️⃣@case
1650
+ }
1651
+ """ ,
1652
+ diagnostics: [ DiagnosticSpec ( message: " unexpected code '@case' in 'switch' statement " ) ]
1653
+ )
1654
+ }
1644
1655
}
You can’t perform that action at this time.
0 commit comments