[5.9 🍒][Compile Time Constant Extraction] Refactor collection of opaque type requirements #67123
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 #67034
• Release: 5.9
• Explanation: To reduce duplication of logic with other parts of the compiler, instead of destructuring the constraint type, write the requirements in the opaque type declaration's generic signature. This also carries a functional fix of correctly aligning the type alias name with the corresponding type witness, instead of attempting to align those from different sources.
• Reviewed by: @slavapestov
• Scope of Issue: Incorrect mapping of opaque return type type alias same-type requirements to the corresponding protocol associated type label may lead to incorrect values in the extracted metadata.
• Risk: Low. This change is a refactor and a fix to the additional metadata gathered (added in #66781). As such, it does not affect compilation which does not request extraction of metadata conformances. For compilation that does request extraction of metadata conformances, the change is small in scope and replaces a fragile code-path with one that should be much more robust.
• Testing: Automated tests added to the compiler test suite.