Skip to content

AsyncIteratorProtocol conformance fixes #72673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 29, 2024

Conversation

DougGregor
Copy link
Member

Fix two issues that make AsyncSequence and AsyncIteratorProtocol conformances harder than necessary:

  • When providing only a next() that uses typed throws, infer the Failure type from the thrown error type of next(). (rdar://125446918)
  • Add a default implementation of next() in terms of next(isolation:), so conforming types can implement only the latter. (rdar://125447861)

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor enabled auto-merge March 28, 2024 18:52
@DougGregor DougGregor changed the title AsyncSequence conformance fixes AsyncIteratorProtocol conformance fixes Mar 28, 2024
When inferring the `Failure` associated type from the `next()` witness,
account for the fact that it might itself use typed throws. Use the
specified thrown error type for the inferred witness of `Failure`.

Fixes rdar://125446918.
New async iterators should be able to implement only `next(isolation:)` and
get the older `next()` implementation via a default. Implement the
appropriate default witness.

Fixes rdar://125447861.
@DougGregor DougGregor force-pushed the async-sequence-fixes branch from f414dda to 220392b Compare March 28, 2024 21:28
@DougGregor DougGregor requested a review from a team as a code owner March 28, 2024 21:28
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@DougGregor DougGregor merged commit 3e10622 into swiftlang:main Mar 29, 2024
@DougGregor DougGregor deleted the async-sequence-fixes branch March 29, 2024 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant