-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Sema] Check protocol conformance availability for member reference and type erasing expressions #41054
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] Check protocol conformance availability for member reference and type erasing expressions #41054
Conversation
…rovided by a protocol conformance be sure to check the availability of conformance. Expands conformance availability tests to include test cases covering member references and key paths. Resolves rdar://87795154.
@swift-ci please smoke test |
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! IIRC there is another missing case with ErasureExpr that occurs when forming an existential from a concrete type, if the concrete type's conformance to the protocol is not available.
Thanks! I'll see what it would take to expand this to cover that expression as well. |
…ons (e.g. `let x: P = S` where S conforms to P). Resolves rdar://83731428.
@swift-ci please smoke test |
2040377
to
d575bba
Compare
@swift-ci please smoke test |
@swift-ci please test macOS |
@swift-ci please smoke test macOS |
In swiftlang#41054, we fixed an oversight which caused us to not notice when a user erased a concrete type to an existential using an unavailable conformance. Unfortunately, this is source-breaking and needs to be reduced to a warning in Swift 5 mode unless the user opts in. Fixes rdar://91940820.
In swiftlang#41054, we fixed an oversight which caused us to not notice when a user erased a concrete type to an existential using an unavailable conformance. Unfortunately, this is source-breaking and needs to be reduced to a warning in Swift 5 mode unless the user opts in. Fixes rdar://91940820.
In swiftlang#41054, we fixed an oversight which caused us to not notice when a user erased a concrete type to an existential using an unavailable conformance. Unfortunately, this is source-breaking and needs to be reduced to a warning in Swift 5 mode unless the user opts in. Fixes rdar://91940820.
Diagnose uses of potentially unavailable protocol conformances in member reference expressions (
x.foo
wherefoo
is a property ofx
) and type erasure expressions (let p: P = S
whereS
conforms toP
) since unguarded uses of these conformances can cause crashes at runtime.Expands conformance availability tests to include test cases covering member references, key paths, and invocation of functions taking existentials.
Resolves rdar://87795154 and rdar://83731428.