[SymbolGraphGen] improve handling of underscored protocols #77251
+189
−47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves rdar://124483146, resolves rdar://128143861
This PR aims to improve SymbolGraphGen's handling of "underscored protocols". These protocols are meant to be treated as an implementation detail and not surfaced in public documentation themselves, even if their methods are meant to be public. An example is the standard library's
_ArrayProtocol
, which a handful of types conform to as part of their Collection conformances. Currently, the symbols that are synthesized as part of_ArrayProtocol
containsourceOrigin
information that surfaces this protocol, which Swift-DocC then uses to sort these symbols under an_ArrayProtocol Implementations
collection page. These methods should instead be treated as native children of the conforming type, discarding any trace of the actual protocol itself.In addition, extensions on these underscored protocols are discarded due to their owning extension adding them to a "private" symbol. We should treat these symbols as natively public and add them to documentation.
This PR also changes the "synthesized symbols" behavior to add synthesized symbols for underscored protocols, even when the user has asked to ignore synthesized symbols or protocol implementations. This should improve the handling of projects that build with
-skip-protocol-implementations
but use underscored protocols, even indirectly via Foundation or the like.