-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[SymbolGraphGen] move "protocol implementations" check into isImplicitlyPrivate #64867
[SymbolGraphGen] move "protocol implementations" check into isImplicitlyPrivate #64867
Conversation
rdar://107432084
@swift-ci Please smoke test |
namespace { | ||
|
||
const ValueDecl *getProtocolRequirement(const ValueDecl *VD) { | ||
auto reqs = VD->getSatisfiedProtocolRequirements(); |
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.
mega nit, llvm code bases tend to do locals in ThisKindOfCamelCase
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.
This code's copy/pasted from Symbol::getProtocolRequirement
, which (IIRC) was itself a refactoring of existing code. I can change it if you want, but i'd be touching some other places too.
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.
ah don't worry about it then.
@@ -45,3 +49,15 @@ public struct SomeStruct: SomeProtocol { | |||
/// Local docs | |||
public func otherFunc() {} | |||
} | |||
|
|||
// Make sure that protocol conformances added in extensions don't create bogus symbol relationships (rdar://107432084) |
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.
can you add a test that checks that we are still emitting it for one that has it's own doc comment?
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.
Pushed a commit that adds this to the test.
@swift-ci Please smoke test |
…tlyPrivate (#64867) rdar://107432084
Resolves rdar://107432084
The original implementation of
-skip-protocol-implementations
focused on dropping symbols that matched the description of "protocol implementation", but didn't extend the check to any extra relationships that can show up. This meant that if a "protocol implementation" symbol is a type that adds a protocol implementation via an extension, that protocol conformance still ends up in the symbol graph, creating a malformed graph where a relationship references a symbol that doesn't exist. This PR moves the "protocol implementation" check intoSymbolGraph::isImplictlyPrivate
, alongside the other checks for dropping a symbol, to catch these scenarios.