Skip to content

[6.0] Concurrency: Fix default type witness for AsyncSequence.Failure #74520

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jun 18, 2024

6.0 cherry-pick of #74445

  • Description: Fix an infinite loop when running older binaries that were built against a standard library that doesn't have the AsyncSequence.Failure associated type.

  • Origination: New bug introduced with typed throws.

  • Reviewed by: @hborla

  • Radar: rdar://129605725

  • Tested: No test case because we don't have a way to automate testing binaries built against an old compiler/stdlib yet.

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.
@slavapestov slavapestov requested a review from a team as a code owner June 18, 2024 16:37
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov merged commit ddee84e into swiftlang:release/6.0 Jun 18, 2024
5 checks passed
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