Repository: apple/swift-syntax (swift)

Issue:
Bad diagnostic if function call is missing an argument label
### Issue Kind

Bad Diagnostic Produced

### Source Code

```swift
foo(: 1)
```


### Description

Currently produces the following diagnostics:

```
stdin:1:5: error: expected value in function call
1 │ foo(: 1)
  │     ├─ error: expected value in function call
  │     ╰─ error: unexpected code ': 1' in function call
```

We should be diagnosing that there is a missing argument label in the call.

Pull request description:

Patch:
diff --git a/Sources/SwiftParser/Expressions.swift b/Sources/SwiftParser/Expressions.swift
index ee6f0f302cb..ce8f0917e67 100644
--- a/Sources/SwiftParser/Expressions.swift
+++ b/Sources/SwiftParser/Expressions.swift
@@ -1861,6 +1861,10 @@ extension Parser {
       if self.atArgumentLabel(allowDollarIdentifier: true) && self.peek(isAt: .colon) {
         (unexpectedBeforeLabel, label) = parseArgumentLabel()
         colon = consumeAnyToken()
+      } else if let _colon = self.consume(if: .colon) {
+        unexpectedBeforeLabel = nil
+        label = RawTokenSyntax(missing: .identifier, arena: self.arena)
+        colon = _colon
       } else {
         unexpectedBeforeLabel = nil
         label = nil


Test patch:
diff --git a/Tests/SwiftParserTest/ExpressionTests.swift b/Tests/SwiftParserTest/ExpressionTests.swift
index 61369c155bb..d13ca3eb237 100644
--- a/Tests/SwiftParserTest/ExpressionTests.swift
+++ b/Tests/SwiftParserTest/ExpressionTests.swift
@@ -2977,4 +2977,17 @@ final class StatementExpressionTests: ParserTestCase {
       substructure: AttributeSyntax(attributeName: TypeSyntax("Sendable"))
     )
   }
+
+  func testFunctionWithMissingLabel() {
+    assertParse(
+      "foo(1️⃣: 1)",
+      diagnostics: [
+        DiagnosticSpec(
+          message: "expected label in function call",
+          fixIts: ["insert label"]
+        )
+      ],
+      fixedSource: "foo(<#identifier#>: 1)"
+    )
+  }
 }