Skip to content

Sema: Fix handling of getter typed throws in witness matching #80445

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
Apr 2, 2025

Conversation

slavapestov
Copy link
Contributor

This fixes witness matching to handle the case where either the requirement or the witness is a property with a throwing getter, and the thrown error type contains a type parameter. There is a similar fix to associated type inference as well. The test case exercises both code paths.

Fixes #80288.
Fixes rdar://problem/147874955.

…erts are enabled

Move this away from the compile-time NDEBUG flag.
Witness matching didn't handle the case where either the
requirement or the witness is a property with a throwing
getter, and the thrown error type contains a type parameter.

We must open the thrown error types first, replacing type
parameters with type variables, for the matching to work.

Associated type inference needs a similar fix. I'll land a
combined test case for both once I fix that.

Fixes swiftlang#80288.
Fixes rdar://problem/147874955.
We must replace type parameters with archetypes in the thrown error type
of the witness. The requirement type remains an interface type.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov merged commit 03d8fd7 into swiftlang:main Apr 2, 2025
4 of 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.

Protocol with typed throwing getter cannot be witnessed
1 participant