Skip to content

[6.2] Sema: Fix regression with 'Failure' type witness inference hack #80536

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 1 commit into from
Apr 8, 2025

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Apr 4, 2025

Cherry-pick of #80511

  • Description: Fixes a regression where a compatibility hack for AsyncIteratorProtocol stopped working if next() was declared in a different extension of the same nominal type.

  • Origination: This regressed in 6.1 when I added the condition to prevent crashes in the case that the witness is in a protocol extension or superclass with a different generic signature. The condition was too narrow.

  • Radar: rdar://problem/145341658.

  • Risk: Low.

  • Reviewed by: @DougGregor

We have a special hack to infer the 'Failure' type witness in
'AsyncIteratorProtocol' by considering the type of 'next()'
witness.

In eaf06ea I added a check to
fix some assertions that could happen if 'next()' was witnessed
by a declaration in a protocol extension or superclass, which
has a different generic signature.

However my check was too narrow, because it also prohibited
this form of inference when 'next()' was in a different
extension of the same nominal type.

Allow this again.

Fixes swiftlang#79367.
Fixes rdar://problem/145341658.
@slavapestov slavapestov requested review from hborla and xedin as code owners April 4, 2025 14:33
@slavapestov slavapestov changed the base branch from main to release/6.2 April 4, 2025 14:34
@hborla
Copy link
Member

hborla commented Apr 6, 2025

@swift-ci please test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test macOS

@slavapestov slavapestov enabled auto-merge April 7, 2025 16:11
@slavapestov
Copy link
Contributor Author

@swift-ci Please test macOS

@slavapestov slavapestov merged commit 3a4215d into swiftlang:release/6.2 Apr 8, 2025
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