Skip to content

Commit 35710cc

Browse files
dbezverkhniiclaude
andcommitted
Test: keep IMAPLoginTests within the package's Swift baseline COR-211
Explicit lock()/unlock() instead of withLock, and no Sendable conformance: the slot is only ever handed to a non-Sendable closure. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 5ea366a commit 35710cc

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎unittest/IMAPLoginTests.swift‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,20 @@ import CMailCore
1919

2020
final class IMAPLoginTests: XCTestCase {
2121

22-
private final class ConnectionSlot: @unchecked Sendable {
22+
private final class ConnectionSlot {
2323
private let lock = NSLock()
2424
private var value: MCOIMAPAsyncConnection?
2525
var connection: MCOIMAPAsyncConnection? {
26-
get { lock.withLock { value } }
27-
set { lock.withLock { value = newValue } }
26+
get {
27+
lock.lock()
28+
defer { lock.unlock() }
29+
return value
30+
}
31+
set {
32+
lock.lock()
33+
value = newValue
34+
lock.unlock()
35+
}
2836
}
2937
}
3038

0 commit comments

Comments
 (0)