Skip to content

[5.7] use getConformingProtocols when printing opaque generic types #59053

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 1 commit into from
May 25, 2022

Conversation

QuietMisdreavus
Copy link
Contributor

Cherry-pick of #58991

Explanation: When a module defines a function that uses some MyProtocol as an argument type, printing the AST from the compiled module will fail. This PR changes the way these opaque types are printed, to use the more-accurate getConformingProtocols instead of getInherited, which is empty in this circumstance.

Scope: Only changes the AST printer, used by module-interface printing and SymbolGraphGen.

Bug: rdar://93610106

Risk: Low. Should not affect normal compilation. The original issue only affected printing the AST from an already-built module, and the change was verified not to change the behavior for printing from parsed source.

Testing: A new lit test, SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/SomeProtocol.swift, has been added to verify that emitting a symbol graph from both parsed source and serialized AST works in this situation. Existing tests still pass.

@QuietMisdreavus QuietMisdreavus marked this pull request as ready for review May 24, 2022 17:46
@QuietMisdreavus QuietMisdreavus requested a review from a team as a code owner May 24, 2022 17:46
@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@QuietMisdreavus QuietMisdreavus merged commit 09f397d into release/5.7 May 25, 2022
@QuietMisdreavus QuietMisdreavus deleted the QuietMisdreavus/5.7/someprotocol branch May 25, 2022 00:28
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.

2 participants