Skip to content

Commit 487488e

Browse files
committed
Compile in 5.10
1 parent 91bb429 commit 487488e

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Sources/ConnectionPoolModule/ConnectionPool.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,11 +587,13 @@ public final class ConnectionPool<
587587

588588
@inlinable
589589
func addTask(into taskGroup: inout some TaskGroupProtocol, operation: @escaping @Sendable () async -> Void) {
590+
#if compiler(>=6.0)
590591
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, *), let executor = self.executor as? TaskExecutor {
591592
taskGroup.addTask_(executorPreference: executor, operation: operation)
592-
} else {
593-
taskGroup.addTask_(operation: operation)
593+
return
594594
}
595+
#endif
596+
taskGroup.addTask_(operation: operation)
595597
}
596598
}
597599

@@ -613,8 +615,10 @@ protocol TaskGroupProtocol {
613615
// a name that doesn't clash anywhere and implement it using the standard `addTask`.
614616
mutating func addTask_(operation: @escaping @Sendable () async -> Void)
615617

618+
#if compiler(>=6.0)
616619
@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, *)
617620
mutating func addTask_(executorPreference: ((any TaskExecutor)?), operation: @escaping @Sendable () async -> Void)
621+
#endif
618622
}
619623

620624
@available(macOS 14.0, iOS 17.0, tvOS 17.0, watchOS 10.0, *)
@@ -624,11 +628,13 @@ extension DiscardingTaskGroup: TaskGroupProtocol {
624628
self.addTask(priority: nil, operation: operation)
625629
}
626630

631+
#if compiler(>=6.0)
627632
@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, *)
628633
@inlinable
629634
mutating func addTask_(executorPreference: (any TaskExecutor)?, operation: @escaping @Sendable () async -> Void) {
630635
self.addTask(executorPreference: executorPreference, operation: operation)
631636
}
637+
#endif
632638
}
633639

634640
extension TaskGroup<Void>: TaskGroupProtocol {
@@ -637,9 +643,11 @@ extension TaskGroup<Void>: TaskGroupProtocol {
637643
self.addTask(priority: nil, operation: operation)
638644
}
639645

646+
#if compiler(>=6.0)
640647
@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, *)
641648
@inlinable
642649
mutating func addTask_(executorPreference: (any TaskExecutor)?, operation: @escaping @Sendable () async -> Void) {
643650
self.addTask(executorPreference: executorPreference, operation: operation)
644651
}
652+
#endif
645653
}

Sources/ConnectionPoolModule/ConnectionPoolManager.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,16 @@ public final class ConnectionPoolManager<
212212
/* private */ func runEvent(_ event: Actions, in taskGroup: inout some TaskGroupProtocol) {
213213
switch event {
214214
case .runPool(let pool):
215+
#if compiler(>=6.0)
215216
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, *), let executor = pool.executor as? TaskExecutor {
216217
taskGroup.addTask_(executorPreference: executor) {
217218
await pool.run()
218219
}
219-
} else {
220-
taskGroup.addTask_ {
221-
await pool.run()
222-
}
220+
return
221+
}
222+
#endif
223+
taskGroup.addTask_ {
224+
await pool.run()
223225
}
224226
}
225227
}

0 commit comments

Comments
 (0)