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 @@ -2689,6 +2689,9 @@ extension Parser {
2689
2689
} else if allowStandaloneStmtRecovery && ( self . atStartOfExpression ( ) || self . atStartOfStatement ( ) || self . atStartOfDeclaration ( ) ) {
2690
2690
// Synthesize a label for the stamenent or declaration that isn't coverd by a case right now.
2691
2691
let statements = parseSwitchCaseBody ( )
2692
+ if statements. isEmpty {
2693
+ break
2694
+ }
2692
2695
elements. append (
2693
2696
. switchCase(
2694
2697
RawSwitchCaseSyntax (
Original file line number Diff line number Diff line change @@ -1231,4 +1231,15 @@ final class StatementExpressionTests: XCTestCase {
1231
1231
]
1232
1232
)
1233
1233
}
1234
+
1235
+ func testStandaloneAtCaseInSwitch( ) {
1236
+ AssertParse (
1237
+ """
1238
+ switch x {
1239
+ 1️⃣@case
1240
+ }
1241
+ """ ,
1242
+ diagnostics: [ DiagnosticSpec ( message: " unexpected code '@case' in 'switch' statement " ) ]
1243
+ )
1244
+ }
1234
1245
}
You can’t perform that action at this time.
0 commit comments