Skip to content

Commit 3b914d5

Browse files
committed
Slight adjustments for older compiler builds and expose the sendable metatypes since those are part of documentation
1 parent 695aa79 commit 3b914d5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Sources/AsyncAlgorithms/AsyncShareSequence.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Synchronization
1313
import DequeModule
1414

1515
@available(AsyncAlgorithms 1.1, *)
16-
extension AsyncSequence where Element: Sendable, Self: _AsyncSequenceSendableMetatype, AsyncIterator: _AsyncIteratorSendableMetatype {
16+
extension AsyncSequence where Element: Sendable, Self: AsyncSequenceSendableMetatype, AsyncIterator: AsyncIteratorSendableMetatype {
1717
/// Creates a shared async sequence that allows multiple concurrent iterations over a single source.
1818
///
1919
/// The `share` method transforms an async sequence into a shareable sequence that can be safely
@@ -107,7 +107,7 @@ extension AsyncSequence where Element: Sendable, Self: _AsyncSequenceSendableMet
107107
// This type is typically not used directly; instead, use the `share()` method on any
108108
// async sequence that meets the sendability requirements.
109109
@available(AsyncAlgorithms 1.1, *)
110-
struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sendable, Base: _AsyncSequenceSendableMetatype, Base.AsyncIterator: _AsyncIteratorSendableMetatype {
110+
struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sendable, Base: AsyncSequenceSendableMetatype, Base.AsyncIterator: AsyncIteratorSendableMetatype {
111111
// Represents a single consumer's connection to the shared sequence.
112112
//
113113
// Each iterator of the shared sequence creates its own `Side` instance, which tracks
@@ -597,7 +597,7 @@ struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sen
597597
}
598598
}
599599
#else
600-
task = Task.detached(name: "Share Iteration") { [factory, self] in
600+
task = Task.detached { [factory, self] in
601601
await iterationLoop(factory: factory)
602602
}
603603
#endif
@@ -618,7 +618,7 @@ struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sen
618618
// Using this priority escalation means that the base task can avoid being detached.
619619
//
620620
// This is disabled for now until the 9999 availability is removed from `withTaskPriorityEscalationHandler`
621-
#if false /*swift(>=6.2)*/
621+
#if false /*compiler(>=6.2)*/
622622
if #available(macOS 26.0, iOS 26.0, tvOS 26.0, visionOS 26.0, *) {
623623
return try await withTaskPriorityEscalationHandler {
624624
return await nextIteration(id)

Sources/AsyncAlgorithms/SendableMetatypes.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
#if compiler(>=6.2)
13-
public typealias _AsyncSequenceSendableMetatype = SendableMetatype
14-
public typealias _AsyncIteratorSendableMetatype = SendableMetatype
13+
public typealias AsyncSequenceSendableMetatype = SendableMetatype & AsyncSequence
14+
public typealias AsyncIteratorSendableMetatype = SendableMetatype & AsyncIteratorProtocol
1515
#else
16-
public typealias _AsyncSequenceSendableMetatype = Any
17-
public typealias _AsyncIteratorSendableMetatype = Any
16+
public typealias AsyncSequenceSendableMetatype = AsyncSequence
17+
public typealias AsyncIteratorSendableMetatype = AsyncIteratorProtocol
1818
#endif

0 commit comments

Comments
 (0)