File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -766,6 +766,9 @@ extension Parser {
766
766
} else if allowStandaloneStmtRecovery && ( self . atStartOfExpression ( ) || self . atStartOfStatement ( ) || self . atStartOfDeclaration ( ) ) {
767
767
// Synthesize a label for the stamenent or declaration that isn't coverd by a case right now.
768
768
let statements = parseSwitchCaseBody ( )
769
+ if statements. isEmpty {
770
+ break
771
+ }
769
772
elements. append (
770
773
. switchCase(
771
774
RawSwitchCaseSyntax (
Original file line number Diff line number Diff line change @@ -618,4 +618,14 @@ final class StatementTests: XCTestCase {
618
618
)
619
619
}
620
620
621
+ func testStandaloneAtCaseInSwitch( ) {
622
+ AssertParse (
623
+ """
624
+ switch x {
625
+ 1️⃣@case
626
+ }
627
+ """ ,
628
+ diagnostics: [ DiagnosticSpec ( message: " unexpected code '@case' in 'switch' statement " ) ]
629
+ )
630
+ }
621
631
}
You can’t perform that action at this time.
0 commit comments