Skip to content
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

[SymbolGraph] Add information about "inherited docs" for synthesized symbols #36863

Merged
merged 5 commits into from
Apr 20, 2021

Conversation

QuietMisdreavus
Copy link
Contributor

Resolves rdar://75741632

This PR adds handling to symbol-graph related code about the concept of "inherited docs", on synthesized symbols inherited from default implementations and classes. There are two primary updates as part of this PR:

  1. For "synthesized" symbols, there is a new field added to the relationship tying the synthesized symbol to its parent: "sourceOrigin". This contains the USR and the display path of the parent symbol.
  2. There is a new flag added to the frontend/driver/symbol-graph tool: -skip-inherited-docs. This changes the symbol-graph code to skip emitting the "docComment" field on synthesized symbols. Since the doc comment is going to be the same as the parent symbol's, this allows a user or tool to skip emitting duplicate information, optimizing the size of the output symbol graph.

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please build toolchain macOS platform

@swift-ci
Copy link
Contributor

macOS Toolchain
Download Toolchain
Git Sha - f4154d6

Install command
tar -zxf swift-PR-36863-940-osx.tar.gz --directory ~/

@QuietMisdreavus
Copy link
Contributor Author

After some more discussion, it looks like we should handle docs inheritance for symbols that aren't synthesized. For example, in my test, the extension's default implementation appears as its own symbol, but inherits its documentation from the protocol. I've pushed a new commit that extends the "inherited docs" behavior to these non-synthesized symbols as well.

@swift-ci Please test

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please build toolchain macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 977f134

@swift-ci
Copy link
Contributor

macOS Toolchain
Download Toolchain
Git Sha - 977f134

Install command
tar -zxf swift-PR-36863-941-osx.tar.gz --directory ~/

@QuietMisdreavus
Copy link
Contributor Author

While testing the toolchain, we ran into some issues where synthesized symbols were directly inheriting docs from the "base" symbol, and losing the sourceOrigin field because the code assumed it wasn't inheriting docs. I've pushed a new commit that adds this field back to synthesized symbols that have docs to inherit.

@swift-ci Please test

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please build toolchain macOS platform

@swift-ci
Copy link
Contributor

macOS Toolchain
Download Toolchain
Git Sha - 8faaee8

Install command
tar -zxf swift-PR-36863-942-osx.tar.gz --directory ~/

Copy link
Contributor

@franklinsch franklinsch left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Franklin Schrans <7278429+franklinsch@users.noreply.github.com>
@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please smoke test

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