File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1861,6 +1861,10 @@ extension Parser {
1861
1861
if self . atArgumentLabel ( allowDollarIdentifier: true ) && self . peek ( isAt: . colon) {
1862
1862
( unexpectedBeforeLabel, label) = parseArgumentLabel ( )
1863
1863
colon = consumeAnyToken ( )
1864
+ } else if let _colon = self . consume ( if: . colon) {
1865
+ unexpectedBeforeLabel = nil
1866
+ label = RawTokenSyntax ( missing: . identifier, arena: self . arena)
1867
+ colon = _colon
1864
1868
} else {
1865
1869
unexpectedBeforeLabel = nil
1866
1870
label = nil
Original file line number Diff line number Diff line change @@ -2977,4 +2977,17 @@ final class StatementExpressionTests: ParserTestCase {
2977
2977
substructure: AttributeSyntax(attributeName: TypeSyntax( " Sendable " ))
2978
2978
)
2979
2979
}
2980
+
2981
+ func testFunctionWithMissingLabel() {
2982
+ assertParse(
2983
+ " foo(1️⃣: 1) " ,
2984
+ diagnostics: [
2985
+ DiagnosticSpec(
2986
+ message: " expected label in function call " ,
2987
+ fixIts: [ " insert label " ]
2988
+ )
2989
+ ],
2990
+ fixedSource: " foo(<#identifier#>: 1) "
2991
+ )
2992
+ }
2980
2993
}
You can’t perform that action at this time.
0 commit comments