Skip to content

Commit 5aac1b7

Browse files
committed
remove swift5 code paths
1 parent 13fff29 commit 5aac1b7

File tree

7 files changed

+8
-72
lines changed

7 files changed

+8
-72
lines changed

FlyingFox/Sources/JSONPredicatePattern.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ import Foundation
3636
@available(*, deprecated, message: "Use JSONBodyPattern")
3737
public struct JSONPredicatePattern: HTTPBodyPattern {
3838

39-
#if compiler(>=6)
4039
nonisolated(unsafe) private var predicate: NSPredicate
41-
#else
42-
@NonisolatedUnsafe private var predicate: NSPredicate
43-
#endif
4440

4541
public init(_ predicate: NSPredicate) {
4642
self.predicate = predicate

FlyingFox/Sources/NonisolatedUnsafe.swift

Lines changed: 0 additions & 45 deletions
This file was deleted.

FlyingFox/Tests/HTTPServerTests.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,8 @@ extension URLSessionWebSocketTask.Message {
622622
}
623623
}
624624
}
625-
#if compiler(>=6)
625+
626626
extension URLSessionWebSocketTask.Message: @retroactive Equatable { }
627-
#else
628-
extension URLSessionWebSocketTask.Message: Equatable { }
629-
#endif
630627
#endif
631628

632629
extension Task where Success == Never, Failure == Never {

FlyingSocks/Sources/Mutex.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
// SOFTWARE.
3030
//
3131

32-
#if compiler(>=6)
33-
3432
#if !canImport(WinSDK)
3533

3634
// Backports the Swift 6 type Mutex<Value> to all Darwin platforms
@@ -215,5 +213,3 @@ package extension Mutex where Value: Sendable & Copyable {
215213
withLock { $0 }
216214
}
217215
}
218-
219-
#endif

FlyingSocks/Sources/SocketPool.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ public final actor SocketPool<Queue: EventQueue>: AsyncSocketPool {
128128

129129
private func getNotifications() async throws -> [EventNotification] {
130130
try Task.checkCancellation()
131-
let queue = UncheckedSendable(wrappedValue: queue)
132-
return try await withIdentifiableThrowingContinuation(isolation: self) { continuation in
131+
nonisolated(unsafe) let queue = queue
132+
return try await withIdentifiableThrowingContinuation { continuation in
133133
dispatchQueue.async {
134134
let result = Result {
135-
try queue.wrappedValue.getNotifications()
135+
try queue.getNotifications()
136136
}
137137
continuation.resume(with: result)
138138
}
@@ -297,11 +297,3 @@ private extension EventNotification {
297297
errors.isEmpty ? .success(()) : .failure(SocketError.disconnected)
298298
}
299299
}
300-
301-
struct UncheckedSendable<Value>: @unchecked Sendable {
302-
var wrappedValue: Value
303-
304-
init(wrappedValue: Value) {
305-
self.wrappedValue = wrappedValue
306-
}
307-
}

FlyingSocks/Tests/SocketPool+PollTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ private extension Poll {
241241
}
242242

243243
func getEvents() async throws -> [EventNotification] {
244-
let queue = UncheckedSendable(wrappedValue: self)
244+
nonisolated(unsafe) let queue = self
245245
return try await withCheckedThrowingContinuation { continuation in
246246
DispatchQueue.global().async {
247247
let result = Result {
248-
try queue.wrappedValue.getNotifications()
248+
try queue.getNotifications()
249249
}
250250
continuation.resume(with: result)
251251
}

FlyingSocks/Tests/SocketPool+kQueueTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ private extension kQueue {
233233
}
234234

235235
func getEvents() async throws -> [EventNotification] {
236-
let queue = UncheckedSendable(wrappedValue: self)
236+
nonisolated(unsafe) let queue = self
237237
return try await withCheckedThrowingContinuation { continuation in
238238
DispatchQueue.global().async {
239239
let result = Result {
240-
try queue.wrappedValue.getNotifications()
240+
try queue.getNotifications()
241241
}
242242
continuation.resume(with: result)
243243
}

0 commit comments

Comments
 (0)