Skip to content

Commit 3482ca0

Browse files
committed
Add availability for the Failure associated type of async sequences
1 parent 0baa5b9 commit 3482ca0

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

stdlib/public/Concurrency/AsyncFlatMapSequence.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ extension AsyncSequence {
7474
@preconcurrency
7575
@_alwaysEmitIntoClient
7676
@inlinable
77+
@available(SwiftStdlib 5.11, *)
7778
public __consuming func flatMap<SegmentOfResult: AsyncSequence>(
7879
_ transform: @Sendable @escaping (Element) async -> SegmentOfResult
7980
) -> AsyncFlatMapSequence<Self, SegmentOfResult>
@@ -110,6 +111,7 @@ extension AsyncSequence {
110111
@preconcurrency
111112
@_alwaysEmitIntoClient
112113
@inlinable
114+
@available(SwiftStdlib 5.11, *)
113115
public __consuming func flatMap<SegmentOfResult: AsyncSequence>(
114116
_ transform: @Sendable @escaping (Element) async -> SegmentOfResult
115117
) -> AsyncFlatMapSequence<Self, SegmentOfResult>
@@ -146,6 +148,7 @@ extension AsyncSequence {
146148
@preconcurrency
147149
@_alwaysEmitIntoClient
148150
@inlinable
151+
@available(SwiftStdlib 5.11, *)
149152
public __consuming func flatMap<SegmentOfResult: AsyncSequence>(
150153
_ transform: @Sendable @escaping (Element) async -> SegmentOfResult
151154
) -> AsyncFlatMapSequence<Self, SegmentOfResult>

stdlib/public/Concurrency/AsyncIteratorProtocol.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public protocol AsyncIteratorProtocol<Element, Failure> {
9090
associatedtype Element
9191

9292
/// The type of failure produced by iteration.
93+
@available(SwiftStdlib 5.11, *)
9394
associatedtype Failure: Error = any Error
9495

9596
/// Asynchronously advances to the next element and returns it, or ends the

stdlib/public/Concurrency/AsyncSequence.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public protocol AsyncSequence<Element, Failure> {
8080
associatedtype Element
8181

8282
/// The type of errors produced when iteration over the sequence fails.
83+
@available(SwiftStdlib 5.11, *)
8384
associatedtype Failure: Error = AsyncIterator.Failure
8485
where AsyncIterator.Failure == Failure
8586

test/Concurrency/typed_throws.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ enum MyError: Error {
77
case epicFailed
88
}
99

10-
@available(SwiftStdlib 5.1, *)
10+
@available(SwiftStdlib 5.11, *)
1111
func testAsyncFor<S: AsyncSequence>(seq: S) async throws(MyError) {
1212
// expected-error@+1{{thrown expression type 'S.Failure' cannot be converted to error type 'MyError'}}
1313
for try await _ in seq {
1414
}
1515
}
1616

17-
@available(SwiftStdlib 5.1, *)
17+
@available(SwiftStdlib 5.11, *)
1818
func testAsyncFor<S: AsyncSequence>(seq: S) async throws(MyError)
1919
where S.Failure == MyError
2020
{

0 commit comments

Comments
 (0)