Skip to content

[SymbolGraph] add sourceOrigin field for symbols implementing remote protocol requirements #37351

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 13, 2021

Conversation

QuietMisdreavus
Copy link
Contributor

Resolves rdar://77626724

Currently, the symbol graph has no way to relate symbols that implement protocol requirements from another module to that remote protocol. This causes situations where "inherited docs" appear on these locally-defined symbols.

This PR adds a sourceOrigin field to these symbols, relating them to their upstream protocol.

@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

macOS Toolchain
Download Toolchain
Git Sha - 81bc80d

Install command
tar -zxf swift-PR-37351-979-osx.tar.gz --directory ~/

func otherFunc()

func bonusFunc()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also test public default implementations of the protocol or is that not relevant?

e.g.,

public extension P {
    /// This one also has docs!
    func someFunc()
}

and assert that "This one also has docs!" doesn't get inherited. I'm not sure about this one because I think the extension someFunc() gets a separate USR than S's someFunc().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Default implementations coming from an extension are tested as part of the existing inherited docs test, though not for protocols in a different module... 🤔

But i'm not sure i understand the situation you're asking about. Can you write an extension like that without an implementation? What happens with someFunc in that situation?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I meant

public extension P {
    /// This one also has docs!
    func someFunc() {}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that makes more sense. I've added a couple more situations to the test.

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please smoke test

@QuietMisdreavus QuietMisdreavus merged commit 51c96a4 into main May 13, 2021
@QuietMisdreavus QuietMisdreavus deleted the QuietMisdreavus/protocol-req-sourceOrigin branch May 13, 2021 16:06
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