Skip to content

Sema: Fix regression with 'Failure' type witness inference hack #80511

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 4, 2025

Conversation

slavapestov
Copy link
Contributor

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 #79367.
Fixes rdar://problem/145341658.

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 3, 2025 21:34
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit b77fdb6 into swiftlang:main Apr 4, 2025
3 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.

[6.1] type does not conform to protocol 'AsyncIteratorProtocol'
1 participant