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

Issue:
error: new Swift parser generated errors for code that C++ parser accepted
### Description

the code in the snippet raises `error: new Swift parser generated errors for code that C++ parser accepted`, but only on toolchains with assertions enabled (`swift-5.10.1-RELEASE-ubuntu24.04`). 

for some reason, i could not locate a 6.0 or main branch toolchain for Ubuntu 24.04 on https://www.swift.org/download/ so i was not able to test those versions.

```
crash2.swift:6:6: error: consecutive statements on a line must be separated by newline or ';'
    } (&y[0])
     ^
crash2.swift:6:6: note: insert newline
    } (&y[0])
     ^
crash2.swift:6:6: note: insert ';'
    } (&y[0])
     ^
      ; 
crash2.swift:1:1: error: new Swift parser generated errors for code that C++ parser accepted
func f(x:[Void])
^
error: fatalError
```


### Reproduction

```swift
func f(x:[Void])
{
    var y:[[Void]] = x.map { [$0] }
    {
        $0.reserveCapacity(1)
    } (&y[0])
}

```


### Expected behavior

?

### Environment

Swift version 5.10.1 (swift-5.10.1-RELEASE)
Target: x86_64-unknown-linux-gnu

### Additional information

_No response_

Pull request:
Introduce some lookahead to make sure we actually have something that looks like an accessor block when the `{` is on the next line, matching what the C++ parser does.

Fixes https://github.com/swiftlang/swift/issues/76089

Patch:
diff --git a/Sources/SwiftParser/Declarations.swift b/Sources/SwiftParser/Declarations.swift
index b403ac8b80c..f063648b8f5 100644
--- a/Sources/SwiftParser/Declarations.swift
+++ b/Sources/SwiftParser/Declarations.swift
@@ -1354,7 +1354,8 @@ extension Parser {
         }
 
         let accessors: RawAccessorBlockSyntax?
-        if self.at(.leftBrace)
+        if (self.at(.leftBrace)
+          && (!self.currentToken.isAtStartOfLine || self.withLookahead({ $0.atStartOfGetSetAccessor() })))
           || (inMemberDeclList && self.at(anyIn: AccessorDeclSyntax.AccessorSpecifierOptions.self) != nil
             && !self.at(.keyword(.`init`)))
         {


Test patch:
diff --git a/Tests/SwiftParserTest/ExpressionTests.swift b/Tests/SwiftParserTest/ExpressionTests.swift
index f5b2f9e0454..babcbffb250 100644
--- a/Tests/SwiftParserTest/ExpressionTests.swift
+++ b/Tests/SwiftParserTest/ExpressionTests.swift
@@ -58,6 +58,18 @@ final class ExpressionTests: ParserTestCase {
       }
       """
     )
+
+    assertParse(
+      """
+      func f(x:[Void])
+      {
+        var y:[[Void]] = x.map { [$0] }
+        {
+          $0.reserveCapacity(1)
+        } (&y[0])
+      }
+      """
+    )
   }
 
   func testTrailingClosures() {