-
Notifications
You must be signed in to change notification settings - Fork 10.5k
swift-module-digester: diagnose adding/removing protocol conformances as API breakages. #19427
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
@swift-ci please smoke test |
@@ -58,6 +58,10 @@ ERROR(decl_added,none,"%0 is added to a non-resilient type", (StringRef)) | |||
|
|||
ERROR(default_arg_removed,none,"%0 has removed default argument from %1", (StringRef, StringRef)) | |||
|
|||
ERROR(conformance_removed,none,"%0 has removed conformance to %1", (StringRef, StringRef)) | |||
|
|||
ERROR(conformance_added,none,"%0 has added conformance to %1", (StringRef, StringRef)) |
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.
Adding a conformance is not an API or ABI break.
Also I'm assuming this applies to resilient types too, and if the conformance is defined in an extension?
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.
The check performs on all types and if the conformance is defined in extensions. Adding conformances can be a problem for protocols (i.e. adding inherited protools).
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.
Please don't model inherited protocols as conformances. Adding an inherited protocol is indeed an API and ABI break, but that's the only case.
A bona-fide "conformance" always involves a concrete type and is its own thing.
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.
It's already been scoped to protocol only in TOT and we've reworded the diagnostic message.
@@ -701,7 +721,16 @@ bool SDKNode::operator==(const SDKNode &Other) const { | |||
} | |||
LLVM_FALLTHROUGH; | |||
} | |||
case SDKNodeKind::DeclType: | |||
case SDKNodeKind::DeclType: { |
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.
What if I'm adding a conformance in an extension, and the extended type is from a different module? You really should model conformances as top-level entities, and not as part of types. Then adding a new conformance is fine (just like adding a new top-level function), but removing one is not allowed.
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.
If the extension is for a type from a different module, the tool will synthesize the type definition in its module dump (here). So the standalone extension won't be missed.
… as API breakages.
ef5ce32
to
08c8cf1
Compare
@swift-ci please smoke test |
…xternal type, we should synthesize only one type decl node.
@swift-ci please smoke test |
@swift-ci Please smoke test Linux platform |
No description provided.