-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Register Conformances as Potential Member Constraints #30585
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
Conversation
Unwind a hack whose stated purpose was to register a potential member edge from an extension to the extended type. In reality, this only registered a plain member dependency on 'deinit'. This edge is insufficient in isolation to cause a rebuild of a dependent file in the case where a type and its extension live in separate files. However, we appear to have been saved by the redundancy in edge registration because the lookup for the extended type will register a top-level or nominal dependency (for an unqualified or qualified reference respectively). The worry there is if a protocol conformance edge *should* flip a previously private nominal dependency edge to a cascading edge. In such a case, the old code would not have been able to make the cascading edge promotion, and we would have potentially miscompiled by not rescheduling dependent jobs.
@swift-ci test |
This whole debacle strongly suggests we should consider adding explicit dependency types for protocol conformances and extensions. |
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'm not terribly qualified to review this PR; while git blame turns up my commit as responsible for recordConformanceDependency(), if you look closely you'll see I was just moving some existing code around when I introduced it.
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.
Looks OK to me. There's one place where an added comment might be nice.
// don't care about /any/ of the type's members, only that it conforms to | ||
// the protocol. | ||
tracker->addUsedMember({Adoptee, DeclBaseName::createDestructor()}, | ||
tracker->addUsedMember({Adoptee, Identifier()}, |
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'd like to see a comment here explaining why the potentialMember dep is needed.
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'll tag you as a reviewer for a follow-up.
⛵️ |
Unwind a hack whose stated purpose was to register a potential member
edge from an extension to the extended type. In reality, this only
registered a plain member dependency on 'deinit'. This edge is
insufficient in isolation to cause a rebuild of a dependent file in the
case where a type and its extension live in separate files. However, we
appear to have been saved by the redundancy in edge registration because the
lookup for the extended type will register a top-level or nominal
dependency (for an unqualified or qualified reference respectively). The
worry there is if a protocol conformance should flip a previously
private nominal dependency edge to a cascading edge. In such a case, the
old code would not have been able to make the cascading edge promotion,
and we would have potentially miscompiled by not rescheduling dependent
jobs.