Skip to content

[Sema] Try limit kicking interface type in filterForEnumElement #80672

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

Conversation

hamishknight
Copy link
Contributor

Kicking the interface type request of the base decl here is wrong if the decl is e.g a self capture in a closure, since we'll be in the middle of type-checking the closure. I'm planning on properly fixing this by folding the lookup into the constraint system, but for now let's at least avoid kicking the request if we don't have an enum case or enum var. That at least prevents it from affecting cases where e.g you're pattern matching against a property in a class.

We could potentially tighten up the checking here even further, but that could potentially impact source compatibility for ambiguous cases. I'd like to keep this patch low risk, and then deal with any fallout as part of the pattern type-checking work.

rdar://146952007

Kicking the interface type request of the base decl here is wrong
if the decl is e.g a `self` capture in a closure, since we'll be in
the middle of type-checking the closure. I'm planning on properly
fixing this by folding the lookup into the constraint system, but for
now let's at least avoid kicking the request if we don't have an enum
case or enum var. That at least prevents it from affecting cases where
e.g you're pattern matching against a property in a class.

We could potentially tighten up the checking here even further, but
that could potentially impact source compatibility for ambiguous
cases. I'd like to keep this patch low risk, and then deal with any
fallout as part of the pattern type-checking work.

rdar://146952007
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight
Copy link
Contributor Author

@swift-ci please test source compatibility

@hamishknight hamishknight merged commit 3490c73 into swiftlang:main Apr 10, 2025
7 checks passed
@hamishknight hamishknight deleted the interfate-type branch April 10, 2025 17:45
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