@@ -342,6 +342,7 @@ where Base.Element: Sendable, Base: AsyncSequenceSendableMetatype, Base.AsyncIte
342
342
let state : Mutex < State >
343
343
let limit : Int ?
344
344
345
+ #if compiler(>=6.1)
345
346
init (
346
347
_ iteratorFactory: @escaping @Sendable ( ) -> sending Base. AsyncIterator ,
347
348
bufferingPolicy: AsyncBufferSequencePolicy
@@ -354,7 +355,20 @@ where Base.Element: Sendable, Base: AsyncSequenceSendableMetatype, Base.AsyncIte
354
355
self . limit = nil
355
356
}
356
357
}
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
358
372
func cancel( ) {
359
373
let ( task, limitContinuation, demand, cancelled) = state. withLock {
360
374
state -> ( IteratingTask ? , UnsafeContinuation < Bool , Never > ? , UnsafeContinuation < Void , Never > ? , Bool ) in
@@ -637,7 +651,7 @@ where Base.Element: Sendable, Base: AsyncSequenceSendableMetatype, Base.AsyncIte
637
651
// Using this priority escalation means that the base task can avoid being detached.
638
652
//
639
653
// 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)
641
655
guard #available( macOS 26 . 0 , iOS 26 . 0 , tvOS 26 . 0 , visionOS 26 . 0 , * ) else {
642
656
return try await nextIteration ( id) . get ( )
643
657
}
0 commit comments