Skip to content

[5.9] Always supersede conformances implied by pre-macro-expansion conformances #68032

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

DougGregor
Copy link
Member

Pre-macro-expansion conformances are introduced at the point where an attached extension macro is attached to a particular nominal type, and can imply other conformances. Once the macro is expanded, they are expected to be replaced by the real conformance from the extension produced by the macro. This includes any other conformances that are implied by that conformances. Ensure that the real conformance---and every conformances it implies---are considered "better" than the pre-expansion conformances.

Fixes a bug where we would pick the wrong (pre-expansion) conformances, which would then fail to get fully type-checked prior to serialization. This could accept invalid code that then crashed the compiler, as in rdar://112916159.

Cherry-picked from #68028

@DougGregor DougGregor requested a review from a team as a code owner August 21, 2023 04:43
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please build toolchain

hborla and others added 2 commits August 21, 2023 13:47
…nces

Pre-macro-expansion conformances are introduced at the point where an
attached extension macro is attached to a particular nominal type, and
can imply other conformances. Once the macro is expanded, they are
expected to be replaced by the real conformance from the extension
produced by the macro. This includes any other conformances that are
implied by that conformances. Ensure that the real conformance---and
every conformances it implies---are considered "better" than the
pre-expansion conformances.

Fixes a bug where we would pick the wrong (pre-expansion)
conformances, which would then fail to get fully type-checked prior to
serialization. This could accept invalid code that then crashed the
compiler, as in rdar://112916159.

(cherry picked from commit ab576b3)
@DougGregor DougGregor force-pushed the supersede-pre-macro-expansion-implied-conformances-5.9 branch from b393a92 to 5fb5a27 Compare August 21, 2023 20:57
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor merged commit ca1b731 into swiftlang:release/5.9 Aug 22, 2023
@DougGregor DougGregor deleted the supersede-pre-macro-expansion-implied-conformances-5.9 branch August 22, 2023 03:21
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