Skip to content

[6.0] AsyncIteratorProtocol conformance fixes #72675

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

Explanation: Address two issues that make conformance to AsyncIteratorProtocol harder to conform to than they need to be. First, correctly infer the thrown error type from next() if it adopts typed throws but next(isolation:) is defaulted. Second, default next() in terms of next(isolation:) so one need only implement one of them.
Issue: rdar://125446918 & rdar://125447861
Original PR: #72673
Risk: Low. The change only impacts associated type inference in a narrow case for new code (where next() has adopted type throws) and makes conformance to AsyncIteratorProtocol simpler.
Testing: New tests.

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 requested a review from a team as a code owner March 28, 2024 19:31
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test Windows

@DougGregor
Copy link
Member Author

@swift-ci please test macOS

@DougGregor DougGregor enabled auto-merge March 29, 2024 04:30
@DougGregor
Copy link
Member Author

@swift-ci please test

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.

2 participants