PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: swiftlang/swift-syntax (swift)

Issue:
"Any.Type" in header always outputs as "Any .Type" with an extra space
### Description

![246605376-4701d2cb-b77b-4c23-a427-aa7612a528f1](https://github.com/apple/swift-syntax/assets/101865961/fc7c6eda-9b3e-4ccf-9e00-2b32a8db50bd)
---
"Any.Type" in header always outputs as "Any .Type" with an extra space.

### Steps to Reproduce

_No response_

Pull request:
Resolves #1815 

Companion PR https://github.com/apple/swift/pull/66799

Patch:
diff --git a/Sources/SwiftBasicFormat/BasicFormat.swift b/Sources/SwiftBasicFormat/BasicFormat.swift
index bf732490310..692a491644a 100644
--- a/Sources/SwiftBasicFormat/BasicFormat.swift
+++ b/Sources/SwiftBasicFormat/BasicFormat.swift
@@ -206,6 +206,7 @@ open class BasicFormat: SyntaxRewriter {
       (.identifier, .leftSquare),  // myArray[1]
       (.identifier, .period),  // a.b
       (.integerLiteral, .period),  // macOS 11.2.1
+      (.keyword(.Any), .period),  // Any.Type
       (.keyword(.`init`), .leftAngle),  // init<T>()
       (.keyword(.`init`), .leftParen),  // init()
       (.keyword(.self), .period),  // self.someProperty


Test patch:
diff --git a/Tests/SwiftSyntaxBuilderTest/VariableTests.swift b/Tests/SwiftSyntaxBuilderTest/VariableTests.swift
index d35a99f1f0f..948045c7d47 100644
--- a/Tests/SwiftSyntaxBuilderTest/VariableTests.swift
+++ b/Tests/SwiftSyntaxBuilderTest/VariableTests.swift
@@ -371,4 +371,17 @@ final class VariableTests: XCTestCase {
       assertBuildResult(builder, expected, line: line)
     }
   }
+
+  // https://github.com/apple/swift-syntax/issues/1815
+  func testSpacingInDictionaryType() throws {
+    let buildable = try VariableDeclSyntax("static var mirror: Dictionary<String, Any.Type>") {}
+
+    assertBuildResult(
+      buildable,
+      """
+      static var mirror: Dictionary<String, Any.Type> {
+      }
+      """
+    )
+  }
 }
Repository: apple/swift-syntax (swift)

Issue:
`ArrayExprSyntax` initializer that takes an array of `ExprSyntax`
### Description

Constructing an `ArrayExprSyntax` from a Swift array of arbitrary `ExprSyntax` values is a bit of a pain. Right now, we do silly dances like:

```swift
let exprs: [ExprSyntax] = ...
let exprString = exprs.lazy
  .map(\.trimmedDescription)
  .joined(separator: ", ")
return ExprSyntax("[\(raw: exprString)]").as(ArrayExprSyntax.self)
```

Having a convenience initializer that inserts commas and necessary trailing trivia would make this much nicer.

Pull request:
Resolve #1674

I have added initializers for `ArrayExprSyntax` and `ArrayElementListSyntax` that allow codes like below

```swift
let expressions: [ExprSyntax] = ...
let arrayExprSyntax = ArrayExprSyntax(expressions: expressions)
```

( I'm not sure if I need to write a test for the `ArrayExprSyntax` initializer or where to place it. )

Patch:
diff --git a/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift b/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift
index a6e811ff336..b6ff4b16bde 100644
--- a/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift
+++ b/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift
@@ -13,6 +13,31 @@
 @_spi(RawSyntax) import SwiftParser
 @_spi(RawSyntax) import SwiftSyntax
 
+// MARK: - ArrayElementList
+
+extension ArrayElementListSyntax {
+  public init(expressions: [ExprSyntax]) {
+    let lastIndex = expressions.count - 1
+    let elements = expressions.enumerated().map { index, expression in
+      let element = ArrayElementSyntax(expression: expression)
+      if index < lastIndex {
+        return element.ensuringTrailingComma()
+      } else {
+        return element
+      }
+    }
+    self.init(elements)
+  }
+}
+
+// MARK: - ArrayExpr
+
+extension ArrayExprSyntax {
+  public init(expressions: [ExprSyntax]) {
+    self.init(elements: ArrayElementListSyntax(expressions: expressions))
+  }
+}
+
 // MARK: - CustomAttribute
 
 extension AttributeSyntax {


Test patch:
diff --git a/Tests/SwiftSyntaxBuilderTest/ArrayExprTests.swift b/Tests/SwiftSyntaxBuilderTest/ArrayExprTests.swift
index 1b5e2759e79..4bdb98bec31 100644
--- a/Tests/SwiftSyntaxBuilderTest/ArrayExprTests.swift
+++ b/Tests/SwiftSyntaxBuilderTest/ArrayExprTests.swift
@@ -47,4 +47,10 @@ final class ArrayExprTests: XCTestCase {
       """
     )
   }
+
+  func testInitializerWithExpressions() {
+    let expressions: [ExprSyntax] = ["0", "1", "2"]
+    let arrayExpr = ArrayExprSyntax(expressions: expressions)
+    XCTAssertEqual(arrayExpr.description, "[0,1,2]")
+  }
 }