Skip to content

[SymbolGraph] add "memberOf" relations for remote protocol implementations #37278

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

Merged
merged 2 commits into from
May 7, 2021

Conversation

QuietMisdreavus
Copy link
Contributor

Resolves rdar://75729692

When generating symbol graphs for a module that includes a default implementation for a protocol from another module, there's currently no way to relate the default implementation to the type or protocol in the current module. This PR adds an additional memberOf relation for these default implementations, that links them to the protocol or type in the current module that it's extending.

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please smoke test

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please build toolchain macOS platform

@swift-ci
Copy link
Contributor

swift-ci commented May 6, 2021

macOS Toolchain
Download Toolchain
Git Sha - 4b5045f

Install command
tar -zxf swift-PR-37278-970-osx.tar.gz --directory ~/

// If P is from a different module, and it's being added to a type
// from the current module, add a `memberOf` relation to the extended
// protocol.
if (MemberVD->getModuleContext() != &M && VD->getDeclContext()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to do a pointer comparison here? Can there be two different pointers to the same module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I'm not sure if it happens in practice, but it's reasonable that there may be two different instances of the same module information. I'll see about comparing some field(s) instead of the pointer itself.

@QuietMisdreavus
Copy link
Contributor Author

Pushed a commit to compare module names instead of pointers.

@swift-ci Please smoke test

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please build toolchain macOS platform

@QuietMisdreavus
Copy link
Contributor Author

macOS tester failed with stale dependencies for SwiftPM. Trying again...

@swift-ci Please smoke test macOS platform

@QuietMisdreavus
Copy link
Contributor Author

The toolchain build also failed in swift-driver incremental tests. Trying again...

@swift-ci Please build toolchain macOS platform

@QuietMisdreavus
Copy link
Contributor Author

Merging before the toolchain is ready, since #37279 was able to be tested in its place.

@QuietMisdreavus QuietMisdreavus merged commit 08d1c33 into main May 7, 2021
@QuietMisdreavus QuietMisdreavus deleted the QuietMisdreavus/default-relation branch May 7, 2021 22:19
@swift-ci
Copy link
Contributor

swift-ci commented May 7, 2021

macOS Toolchain
Download Toolchain
Git Sha - 633ffec

Install command
tar -zxf swift-PR-37278-975-osx.tar.gz --directory ~/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants