@@ -342,6 +342,7 @@ where Base.Element: Sendable, Base: AsyncSequenceSendableMetatype, Base.AsyncIte
342342 let state : Mutex < State >
343343 let limit : Int ?
344344
345+ #if compiler(>=6.1)
345346 init (
346347 _ iteratorFactory: @escaping @Sendable ( ) -> sending Base. AsyncIterator ,
347348 bufferingPolicy: AsyncBufferSequencePolicy
@@ -354,7 +355,20 @@ where Base.Element: Sendable, Base: AsyncSequenceSendableMetatype, Base.AsyncIte
354355 self . limit = nil
355356 }
356357 }
357-
358+ #else
359+ init (
360+ _ iteratorFactory: @escaping @Sendable ( ) -> Base . AsyncIterator ,
361+ bufferingPolicy: AsyncBufferSequencePolicy
362+ ) {
363+ state = Mutex ( State ( iteratorFactory, bufferingPolicy: bufferingPolicy) )
364+ switch bufferingPolicy. policy {
365+ case . bounded( let limit) :
366+ self . limit = limit
367+ default :
368+ self . limit = nil
369+ }
370+ }
371+ #endif
358372 func cancel( ) {
359373 let ( task, limitContinuation, demand, cancelled) = state. withLock {
360374 state -> ( IteratingTask ? , UnsafeContinuation < Bool , Never > ? , UnsafeContinuation < Void , Never > ? , Bool ) in
@@ -637,7 +651,7 @@ where Base.Element: Sendable, Base: AsyncSequenceSendableMetatype, Base.AsyncIte
637651 // Using this priority escalation means that the base task can avoid being detached.
638652 //
639653 // This is disabled for now until the 9999 availability is removed from `withTaskPriorityEscalationHandler`
640- #if false /* compiler(>=6.2)*/
654+ #if false // replace with compiler(>=6.2)
641655 guard #available( macOS 26 . 0 , iOS 26 . 0 , tvOS 26 . 0 , visionOS 26 . 0 , * ) else {
642656 return try await nextIteration ( id) . get ( )
643657 }
0 commit comments