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 {
18611861 if self . atArgumentLabel ( allowDollarIdentifier: true ) && self . peek ( isAt: . colon) {
18621862 ( unexpectedBeforeLabel, label) = parseArgumentLabel ( )
18631863 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
18641868 } else {
18651869 unexpectedBeforeLabel = nil
18661870 label = nil
Original file line number Diff line number Diff line change @@ -2977,4 +2977,17 @@ final class StatementExpressionTests: ParserTestCase {
29772977 substructure: AttributeSyntax(attributeName: TypeSyntax( " Sendable " ))
29782978 )
29792979 }
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+ }
29802993}
You can’t perform that action at this time.
0 commit comments