Repository: swiftlang/swift-syntax (swift)

Issue:
`BasicFormat` doesn't add spaces between first and second parameter name
### Description

When using `FunctionParameterSyntax` with `SwiftSyntaxBuilder`, the build result (formatted by `BasicFormat`) doesn't have spaces between first and second parameter names, which is "lexically legal" but far against user intention.

### Steps to Reproduce

```swift
let parameter = FunctionParameterSyntax(firstName: "on", secondName: "eventLoop", colon: .colonToken(), type: TypeSyntax("EventLoop"))
print(parameter) // oneventLoop: EventLoop
```

Pull request:
Fixes #1505

Patch:
diff --git a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift
index 6aef6e887b5..96911aab784 100644
--- a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift
+++ b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift
@@ -809,7 +809,7 @@ public let DECL_NODES: [Node] = [
       // name to avoid backtracking.
       Child(
         name: "SecondName",
-        kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "WildcardToken")]),
+        kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "WildcardToken")], requiresLeadingSpace: true),
         nameForDiagnostics: "internal name",
         isOptional: true
       ),
diff --git a/Sources/SwiftBasicFormat/generated/BasicFormat.swift b/Sources/SwiftBasicFormat/generated/BasicFormat.swift
index b0a446d8bac..8eef6f259d6 100644
--- a/Sources/SwiftBasicFormat/generated/BasicFormat.swift
+++ b/Sources/SwiftBasicFormat/generated/BasicFormat.swift
@@ -170,6 +170,8 @@ open class BasicFormat: SyntaxRewriter {
     switch keyPath {
     case \AvailabilityArgumentSyntax.entry:
       return false
+    case \FunctionParameterSyntax.secondName:
+      return true
     default:
       return nil
     }


Test patch:
diff --git a/Tests/SwiftSyntaxBuilderTest/FunctionParameterSyntaxTests.swift b/Tests/SwiftSyntaxBuilderTest/FunctionParameterSyntaxTests.swift
new file mode 100644
index 00000000000..1cd98a3149b
--- /dev/null
+++ b/Tests/SwiftSyntaxBuilderTest/FunctionParameterSyntaxTests.swift
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See https://swift.org/LICENSE.txt for license information
+// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+//===----------------------------------------------------------------------===//
+
+import XCTest
+import SwiftSyntax
+import SwiftSyntaxBuilder
+
+final class FunctionParameterSyntaxTests: XCTestCase {
+  func testFunctionParameterSyntaxSpacing() {
+    let builder = FunctionParameterSyntax(firstName: "on", secondName: "eventLoop", type: TypeSyntax("EventLoop"))
+    assertBuildResult(
+      builder,
+      """
+      on eventLoop: EventLoop
+      """
+    )
+  }
+}