[6.0 🍒] Apply the @_alwaysEmitConformanceMetadata
semantics to conformances originating from macro-expanded declarations and extensions
#73681
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 #73680
Explanation: The attribute added in #60367 causes the compiler to ensure that conformances to protocols annotated with the
@_alwaysEmitConformanceMetadata
attribute are in the resulting binaries even if the conformance itself is notpublic
or even used elsewhere in the code. The current implementation (#69609) of this attribute does not account that such conformances may originate from macro-expansions. This change fixes that by causing the detection logic to consider macro-expanded contexts.Risk: Low. This change extends the existing declaration walker by causing it to also walk macro-expanded declarations in order to find conformances to attribute annotated protocols. For code not annotated with this attribute this will not result in any changes. And for code that is annotated, the produced binaries will contain the expected results, whereas they did not before.
Testing: Automated test added to the compiler test suite.
Resolves rdar://127903662