@@ -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
634640extension 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}
0 commit comments