@@ -587,11 +587,13 @@ public final class ConnectionPool<
587
587
588
588
@inlinable
589
589
func addTask( into taskGroup: inout some TaskGroupProtocol , operation: @escaping @Sendable ( ) async -> Void ) {
590
+ #if compiler(>=6.0)
590
591
if #available( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , watchOS 11 . 0 , * ) , let executor = self . executor as? TaskExecutor {
591
592
taskGroup. addTask_ ( executorPreference: executor, operation: operation)
592
- } else {
593
- taskGroup. addTask_ ( operation: operation)
593
+ return
594
594
}
595
+ #endif
596
+ taskGroup. addTask_ ( operation: operation)
595
597
}
596
598
}
597
599
@@ -613,8 +615,10 @@ protocol TaskGroupProtocol {
613
615
// a name that doesn't clash anywhere and implement it using the standard `addTask`.
614
616
mutating func addTask_( operation: @escaping @Sendable ( ) async -> Void )
615
617
618
+ #if compiler(>=6.0)
616
619
@available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , watchOS 11 . 0 , * )
617
620
mutating func addTask_( executorPreference: ( ( any TaskExecutor ) ? ) , operation: @escaping @Sendable ( ) async -> Void )
621
+ #endif
618
622
}
619
623
620
624
@available ( macOS 14 . 0 , iOS 17 . 0 , tvOS 17 . 0 , watchOS 10 . 0 , * )
@@ -624,11 +628,13 @@ extension DiscardingTaskGroup: TaskGroupProtocol {
624
628
self . addTask ( priority: nil , operation: operation)
625
629
}
626
630
631
+ #if compiler(>=6.0)
627
632
@available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , watchOS 11 . 0 , * )
628
633
@inlinable
629
634
mutating func addTask_( executorPreference: ( any TaskExecutor ) ? , operation: @escaping @Sendable ( ) async -> Void ) {
630
635
self . addTask ( executorPreference: executorPreference, operation: operation)
631
636
}
637
+ #endif
632
638
}
633
639
634
640
extension TaskGroup < Void > : TaskGroupProtocol {
@@ -637,9 +643,11 @@ extension TaskGroup<Void>: TaskGroupProtocol {
637
643
self . addTask ( priority: nil , operation: operation)
638
644
}
639
645
646
+ #if compiler(>=6.0)
640
647
@available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , watchOS 11 . 0 , * )
641
648
@inlinable
642
649
mutating func addTask_( executorPreference: ( any TaskExecutor ) ? , operation: @escaping @Sendable ( ) async -> Void ) {
643
650
self . addTask ( executorPreference: executorPreference, operation: operation)
644
651
}
652
+ #endif
645
653
}
0 commit comments