[5.7] use getConformingProtocols when printing opaque generic types #59053
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.
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-accurategetConformingProtocols
instead ofgetInherited
, 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.