Skip to content

Commit 61d00ca

Browse files
committed
Concurrency: Fix default type witness for AsyncSequence.Failure
Setting this to Self.AsyncIterator.Failure doesn't work because we replace it with its reduced type Self.Failure, and then if you run a binary compiled against an older version of the stdlib that does not declare the Failure associated type, we hit infinite recursion while instantiating the witness table and trying to populate the default type witness. Instead, let's set the default to `any Error`. Associated type inference is already smart enough to infer the type witness from the AsyncIterator's Failure type; we don't need to rely on the default mechanism for that. Fixes rdar://129605725.
1 parent b3a8ae8 commit 61d00ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/Concurrency/AsyncSequence.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public protocol AsyncSequence<Element, Failure> {
8181

8282
/// The type of errors produced when iteration over the sequence fails.
8383
@available(SwiftStdlib 6.0, *)
84-
associatedtype Failure: Error = AsyncIterator.Failure
84+
associatedtype Failure: Error = any Error
8585
where AsyncIterator.Failure == Failure
8686

8787
/// Creates the asynchronous iterator that produces elements of this

0 commit comments

Comments
 (0)