Skip to content
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

Sema: Relax primary associated type matching in matchExistentialTypes() #78559

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jan 10, 2025

I found a soundness hole and fixed it in #77178, where we would allow conversion between any P<T> and any Q<T> where P inherits from Q, even if P and Q declare different primary associated types.

However, the fix was too strict, because we still want to allow the conversion when the associated types have the same name -- if one protocol inherits from two protocols that both declare an A, the two As become semantically equivalent.

Fixes rdar://141968103.

Recently I found a soundness hole here, where we would allow conversion
between `any P<T>` and `any Q<T>` even if P and Q have different primary
associated types.

However, the fix was too strict, because we still want to allow the
conversion when the associated types have the same name.

Fixes rdar://141968103.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

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.

3 participants