Skip to content

[IDE][SourceKit/DocSupport] Add members of underscored protocol extensions in extensions of conforming types. #32148

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

Conversation

nathawes
Copy link
Contributor

@nathawes nathawes commented Jun 2, 2020

We would previously hide underscored protocols and their extensions and members, but the _ prefix really just means the protocols themselves aren't intended for clients, rather than their members.

This also adds support for fully_annotated_decl entries for extensions in doc-info in order to be consistent with every other decl, and removes the 'fully_annotated_generic_signature' entry we supplied as a fallback.

Also fixes several bugs with the synthesized extensions mechanism:

  • The type substitutions applied to the extension's requirements were computed using the extension itself as the decl context rather than the extension's nominal. The meant the extension's requirements themselves were assumed to hold when determining the substitutions, so equality constraints were always met. Because of this extension members were incorrectly merged with the base nominal or its extensions despite having additional constraints.
  • Types within the requirements weren't being transformed when printed (e.g. Self.Element was printed rather than T) both in the interface output and in the requirements list. We were also incorrectly printing requirements that were already satisfied once the base type was substituted in.
  • If both the protocol extension and 'enabling' extension of the base nominal that added the protocol conformance had conditional requirements, we were only printing the protocol extension's requirements in the synthesized extension.
  • The USR and annotated decl output embedded in the key.doc.full_as_xml string for synthesized members were printed to match their original context, rather than the synthesized one.

Resolves rdar://problem/57121937

@nathawes
Copy link
Contributor Author

nathawes commented Jun 2, 2020

@swift-ci please test

…sions in extensions of conforming types.

We would previously hide the protocol, its extensions and members, but the '_'
prefix really just means the protocol itself isn't intended for clients, rather
than its members.

This also adds support for 'fully_annotated_decl' entries in doc-info for
extensions to be consistent with every other decl, and removes the
'fully_annotated_generic_signature' entry we supplied as a fallback.

Also fixes several bugs with the synthesized extensions mechanism:
- The type sustitutions applied to the extension's requirements were computed
  using the extension itself as the decl context rather than the extension's
  nominal. The meant the extension's requirements themselves were assumed to
  hold when determining the substitutions, so equality constraints were always
  met. Because of this extension members were incorrectly merged with the base
  nominal or its extensions despite having additional constraints.
- Types within the requirements weren't being transformed when printed (e.g.
  'Self.Element' was printed rather than 'T') both in the interface output and
  in the requirements list. We were also incorrectly printing requirements
  that were already satisfied once the base type was subsituted in.
- If both the protocol extension and 'enabling' extension of the base nominal
  that added the protocol conformance had conditional requirements, we were
  only printing the protocol extension's requirements in the synthesized
  extension.
- The USR and annotated decl output embedded in the 'key.doc.full_as_xml'
  string for synthesized members were printed to match their original context, rather than
  the synthesized one.

Resolves rdar://problem/57121937
@nathawes nathawes force-pushed the doc-info-underscored-protocol-synthesised-extensions branch from b19681a to 51bace6 Compare June 2, 2020 22:38
@nathawes
Copy link
Contributor Author

nathawes commented Jun 2, 2020

@swift-ci please test

@swiftlang swiftlang deleted a comment from swift-ci Jun 2, 2020
@swift-ci
Copy link
Contributor

swift-ci commented Jun 2, 2020

Build failed
Swift Test OS X Platform
Git Sha - b19681a76ab80ac95fd16ff4b470e171cae74839

@nathawes
Copy link
Contributor Author

nathawes commented Jun 3, 2020

@swift-ci please test OS X Platform

@nathawes nathawes requested a review from akyrtzi June 6, 2020 00:34
@nathawes nathawes merged commit 41758c0 into swiftlang:master Jun 10, 2020
@nathawes nathawes deleted the doc-info-underscored-protocol-synthesised-extensions branch June 10, 2020 21:49
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