Commit 96247c0
committed
Add sendable annotation to
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).userInfo closure1 parent 94ba7ea commit 96247c0
File tree
4 files changed
+11
-7
lines changed- Sources
- LanguageServerProtocolJSONRPC
- SKTestSupport
- Tests/LanguageServerProtocolJSONRPCTests
4 files changed
+11
-7
lines changedLines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
371 | 373 | | |
372 | 374 | | |
373 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
370 | 372 | | |
371 | 373 | | |
372 | 374 | | |
| |||
417 | 419 | | |
418 | 420 | | |
419 | 421 | | |
420 | | - | |
| 422 | + | |
421 | 423 | | |
422 | 424 | | |
423 | 425 | | |
| |||
462 | 464 | | |
463 | 465 | | |
464 | 466 | | |
465 | | - | |
| 467 | + | |
466 | 468 | | |
467 | 469 | | |
468 | 470 | | |
| |||
0 commit comments