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 {
22532253 } else if allowStandaloneStmtRecovery && ( self . atStartOfExpression ( ) || self . atStartOfStatement ( ) || self . atStartOfDeclaration ( ) ) {
22542254 // Synthesize a label for the stamenent or declaration that isn't coverd by a case right now.
22552255 let statements = parseSwitchCaseBody ( )
2256+ if statements. isEmpty {
2257+ break
2258+ }
22562259 elements. append (
22572260 . switchCase(
22582261 RawSwitchCaseSyntax (
Original file line number Diff line number Diff line change @@ -1641,4 +1641,15 @@ final class StatementExpressionTests: XCTestCase {
16411641 ]
16421642 )
16431643 }
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+ }
16441655}
You can’t perform that action at this time.
0 commit comments