Skip to content

Commit 50665ab

Browse files
committed
Revert "Implement AsyncIteratorProtocol.next() in terms of next(isolation:)."
This reverts commit bf38117.
1 parent 3f98a9f commit 50665ab

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

stdlib/public/Concurrency/AsyncIteratorProtocol.swift

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ public protocol AsyncIteratorProtocol<Element, Failure> {
111111

112112
@available(SwiftStdlib 5.1, *)
113113
extension AsyncIteratorProtocol {
114-
/// Default implementation of `next(isolation:)` in terms of `next()`, which
115-
/// is required to maintain backward compatibility with existing async
116-
/// iterators.
114+
/// Default implementation of `next()` in terms of `next()`, which is
115+
/// required to maintain backward compatibility with existing async iterators.
117116
@available(SwiftStdlib 6.0, *)
118117
@inlinable
119118
public mutating func next(isolation actor: isolated (any Actor)?) async throws(Failure) -> Element? {
@@ -124,19 +123,3 @@ extension AsyncIteratorProtocol {
124123
}
125124
}
126125
}
127-
128-
@available(SwiftStdlib 5.1, *)
129-
extension AsyncIteratorProtocol {
130-
/// Default implementation of `next()` in terms of `next(isolation:)`, which
131-
/// is required to maintain backward compatibility with existing async
132-
/// iterators.
133-
@available(SwiftStdlib 6.0, *)
134-
@inlinable
135-
public mutating func next() async throws(Failure) -> Element? {
136-
#if $OptionalIsolatedParameters
137-
return try await next(isolation: nil)
138-
#else
139-
fatalError("unsupported compiler")
140-
#endif
141-
}
142-
}

test/Concurrency/async_sequence_rethrows.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,3 @@ enum MyError: Error {
7575
func getASequence() -> any AsyncSequence<Data, MyError> {
7676
return ErrorSequence<Data, _>(throwError: MyError.foo) // ERROR: Cannot convert return expression of type 'any Error' to return type 'MyError'
7777
}
78-
79-
// Test the default implementation of next() in terms of next(isolation:).
80-
struct AsyncIteratorWithOnlyNextIsolation: AsyncIteratorProtocol {
81-
public mutating func next(isolation: (any Actor)?) throws(MyError) -> Int? { 0 }
82-
}
83-
84-
// Test the default implementation of next(isolation:) in terms of next().
85-
struct AsyncIteratorWithOnlyNext: AsyncIteratorProtocol {
86-
public mutating func next() throws(MyError) -> Int? { 0 }
87-
}

0 commit comments

Comments
 (0)