-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AST] Special handling for existentials with superclass and marker pr… #71855
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
[AST] Special handling for existentials with superclass and marker pr… #71855
Conversation
@swift-ci please test |
@swift-ci please test macOS platform |
if (auto superclass = layout.explicitSuperclass) { | ||
if (auto result = | ||
lookupConformance(superclass, protocol, /*allowMissing=*/false)) { | ||
if (protocol->isSpecificProtocol(KnownProtocolKind::Sendable) && |
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.
Is the true branch reachable? It seems we only call this if !protocol->existentialConformsToSelf() but that would be false for Sendable
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.
I just moved this code over so I'm not sure.
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.
I saw this in a couple other places I think, will investigate!
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.
Okay, we do call this in two places where !protocol->existentialConformsToSelf()
and later on in case when it is, so it would be reachable at leave in one spot.
b7c6055
to
7526af5
Compare
@swift-ci please test |
…otocols Even if protocol is not self-conforming it should be okay to produce a conformance based on superclass if protocol bounds of the existential are all marker protocols. Superclass concrete conformance is wrapped into an inherited conformance in such cases to reference the existential.
…lowMarkerProtocols` flag
7526af5
to
0ab7e12
Compare
@swift-ci please test |
…ngleTypeForFlatUniqueTypeRef` The original check introduced by swiftlang#71855 is too broad. For concrete metadata we call the runtime demangler so we need to strip off marker protocols when mangling that string and `mangleTypeForReflection` already does that.
…ngleTypeForFlatUniqueTypeRef` The original check introduced by swiftlang#71855 is too broad. For concrete metadata we call the runtime demangler so we need to strip off marker protocols when mangling that string and `mangleTypeForReflection` already does that.
…ngleTypeForFlatUniqueTypeRef` The original check introduced by swiftlang#71855 is too broad. For concrete metadata we call the runtime demangler so we need to strip off marker protocols when mangling that string and `mangleTypeForReflection` already does that.
…ngleTypeForFlatUniqueTypeRef` The original check introduced by swiftlang#71855 is too broad. For concrete metadata we call the runtime demangler so we need to strip off marker protocols when mangling that string and `mangleTypeForReflection` already does that. (cherry picked from commit 5d243bd)
…otocols
Even if protocol is not self-conforming it should be okay to produce a conformance based on superclass
if protocol bounds of the existential are all marker protocols.
Superclass concrete conformance is wrapped into an inherited conformance in such cases to
reference the existential.