Files
sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC
Ben Barham 96247c0472 Add sendable annotation to userInfo closure
swift-foundation recently landed a change (in
swiftlang/swift-foundation#764) which requires `any Sendable` values in
`JSONEncoder.userInfo`. This causes a build failure:
```
JSONRPCConnection.swift:370:50: error: type '(RequestID) -> Optional<any ResponseType.Type>' does not conform to the 'Sendable' protocol
368 |
369 |     // Setup callback for response type.
370 |     decoder.userInfo[.responseTypeCallbackKey] = { (id: RequestID) -> ResponseType.Type? in
    |                                                  |- error: type '(RequestID) -> Optional<any ResponseType.Type>' does not conform to the 'Sendable' protocol
    |                                                  `- note: a function type must be marked '@Sendable' to conform to 'Sendable'
371 |       guard let outstanding = self.outstandingRequests[id] else {
372 |         logger.error("Unknown request for \(id, privacy: .public)")
```

Make the closure sendable, which is safe as we're only reading from
`outstandingRequests` (where all our writes are guarded by the same
queue that the decoding is on).
2025-02-17 08:31:07 -08:00
..
2024-07-25 09:11:13 -07:00