@@ -419,7 +419,7 @@ public final class ConnectionPool<
419
419
420
420
@inlinable
421
421
/*private*/ func makeConnection( for request: StateMachine . ConnectionRequest , in taskGroup: inout some TaskGroupProtocol ) {
422
- taskGroup. addTask {
422
+ taskGroup. addTask_ {
423
423
self . observabilityDelegate. startedConnecting ( id: request. connectionID)
424
424
425
425
do {
@@ -468,7 +468,7 @@ public final class ConnectionPool<
468
468
/*private*/ func runKeepAlive( _ connection: Connection , in taskGroup: inout some TaskGroupProtocol ) {
469
469
self . observabilityDelegate. keepAliveTriggered ( id: connection. id)
470
470
471
- taskGroup. addTask {
471
+ taskGroup. addTask_ {
472
472
do {
473
473
try await self . keepAliveBehavior. runKeepAlive ( for: connection)
474
474
@@ -503,7 +503,7 @@ public final class ConnectionPool<
503
503
504
504
@inlinable
505
505
/*private*/ func runTimer( _ timer: StateMachine . Timer , in poolGroup: inout some TaskGroupProtocol ) {
506
- poolGroup. addTask { ( ) async -> ( ) in
506
+ poolGroup. addTask_ { ( ) async -> ( ) in
507
507
await withTaskGroup ( of: TimerRunResult . self, returning: Void . self) { taskGroup in
508
508
taskGroup. addTask {
509
509
do {
@@ -587,17 +587,25 @@ extension AsyncStream {
587
587
588
588
@usableFromInline
589
589
protocol TaskGroupProtocol {
590
- mutating func addTask( operation: @escaping @Sendable ( ) async -> Void )
590
+ // We need to call this `addTask_` because some Swift versions define this
591
+ // under exactly this name and others have different attributes. So let's pick
592
+ // a name that doesn't clash anywhere and implement it using the standard `addTask`.
593
+ mutating func addTask_( operation: @escaping @Sendable ( ) async -> Void )
591
594
}
592
595
593
596
#if swift(>=5.8) && os(Linux) || swift(>=5.9)
594
597
@available ( macOS 14 . 0 , iOS 17 . 0 , tvOS 17 . 0 , watchOS 10 . 0 , * )
595
- extension DiscardingTaskGroup : TaskGroupProtocol { }
598
+ extension DiscardingTaskGroup : TaskGroupProtocol {
599
+ @inlinable
600
+ mutating func addTask_( operation: @escaping @Sendable ( ) async -> Void ) {
601
+ self . addTask ( priority: nil , operation: operation)
602
+ }
603
+ }
596
604
#endif
597
605
598
606
extension TaskGroup < Void > : TaskGroupProtocol {
599
607
@inlinable
600
- mutating func addTask ( operation: @escaping @Sendable ( ) async -> Void ) {
608
+ mutating func addTask_ ( operation: @escaping @Sendable ( ) async -> Void ) {
601
609
self . addTask ( priority: nil , operation: operation)
602
610
}
603
611
}
0 commit comments