@@ -419,7 +419,7 @@ public final class ConnectionPool<
419419
420420 @inlinable
421421 /*private*/ func makeConnection( for request: StateMachine . ConnectionRequest , in taskGroup: inout some TaskGroupProtocol ) {
422- taskGroup. addTask {
422+ taskGroup. addTask_ {
423423 self . observabilityDelegate. startedConnecting ( id: request. connectionID)
424424
425425 do {
@@ -468,7 +468,7 @@ public final class ConnectionPool<
468468 /*private*/ func runKeepAlive( _ connection: Connection , in taskGroup: inout some TaskGroupProtocol ) {
469469 self . observabilityDelegate. keepAliveTriggered ( id: connection. id)
470470
471- taskGroup. addTask {
471+ taskGroup. addTask_ {
472472 do {
473473 try await self . keepAliveBehavior. runKeepAlive ( for: connection)
474474
@@ -503,7 +503,7 @@ public final class ConnectionPool<
503503
504504 @inlinable
505505 /*private*/ func runTimer( _ timer: StateMachine . Timer , in poolGroup: inout some TaskGroupProtocol ) {
506- poolGroup. addTask { ( ) async -> ( ) in
506+ poolGroup. addTask_ { ( ) async -> ( ) in
507507 await withTaskGroup ( of: TimerRunResult . self, returning: Void . self) { taskGroup in
508508 taskGroup. addTask {
509509 do {
@@ -587,17 +587,25 @@ extension AsyncStream {
587587
588588@usableFromInline
589589protocol 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 )
591594}
592595
593596#if swift(>=5.8) && os(Linux) || swift(>=5.9)
594597@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+ }
596604#endif
597605
598606extension TaskGroup < Void > : TaskGroupProtocol {
599607 @inlinable
600- mutating func addTask ( operation: @escaping @Sendable ( ) async -> Void ) {
608+ mutating func addTask_ ( operation: @escaping @Sendable ( ) async -> Void ) {
601609 self . addTask ( priority: nil , operation: operation)
602610 }
603611}
0 commit comments