Skip to content

[5.9][Macros] Pass a list of protocols to conform to when expanding an extension macro. #1873

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 7 commits into from
Jul 3, 2023

Conversation

hborla
Copy link
Member

@hborla hborla commented Jul 2, 2023

  • Explanation: This change does two things:
  1. Makes ConformanceMacro refine ExtensionMacro with a default implementation to help migrate to the new protocol.
  2. Adds a parameter to ExtensionMacro.expansion to indicate which protocols the macro should add a conformance to.

hborla added 7 commits July 2, 2023 11:34
This changes the ConformanceMacro protocol to refine ExtensionMacro, and provide
a default implementation of ExtensionMacro.expansion that calls the conformance
expansion method. This way, conformance macros and extension macros can share the
same expansion code path.

(cherry picked from commit d20f066)
…parameter to

expandAttachedMacro.

(cherry picked from commit adb044e)
…acro to

add the 'conformingTo' parameter.

(cherry picked from commit ec41bd6)
compiler_plugin_basic.swift.

(cherry picked from commit 852a0b2)
(cherry picked from commit bf0d394)
@hborla
Copy link
Member Author

hborla commented Jul 2, 2023

swiftlang/swift#67083

@swift-ci please test

@hborla
Copy link
Member Author

hborla commented Jul 3, 2023

swiftlang/swift#67083

@swift-ci please test

@hborla hborla merged commit 59ed009 into swiftlang:release/5.9 Jul 3, 2023
@hborla hborla deleted the 5.9-refine-extension-macros branch July 3, 2023 21:43
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