Skip to content

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

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 Jun 30, 2023

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.

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.
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@hborla hborla force-pushed the refine-extension-macros branch 2 times, most recently from af6de8c to 594209d Compare June 30, 2023 23:01
@hborla hborla marked this pull request as ready for review June 30, 2023 23:07
@hborla hborla requested a review from ahoppen as a code owner June 30, 2023 23:07
@hborla
Copy link
Member Author

hborla commented Jun 30, 2023

swiftlang/swift#67070

@swift-ci please test

2 similar comments
@hborla
Copy link
Member Author

hborla commented Jul 1, 2023

swiftlang/swift#67070

@swift-ci please test

@hborla
Copy link
Member Author

hborla commented Jul 1, 2023

swiftlang/swift#67070

@swift-ci please test

@hborla hborla force-pushed the refine-extension-macros branch from 17a3337 to 14e02c2 Compare July 1, 2023 21:54
@hborla
Copy link
Member Author

hborla commented Jul 1, 2023

swiftlang/swift#67070

@swift-ci please test

@hborla hborla force-pushed the refine-extension-macros branch from 14e02c2 to bf0d394 Compare July 1, 2023 23:35
@hborla
Copy link
Member Author

hborla commented Jul 1, 2023

swiftlang/swift#67070

@swift-ci please test

@hborla
Copy link
Member Author

hborla commented Jul 2, 2023

swiftlang/swift#67070

@swift-ci please test Windows

2 similar comments
@hborla
Copy link
Member Author

hborla commented Jul 2, 2023

swiftlang/swift#67070

@swift-ci please test Windows

@hborla
Copy link
Member Author

hborla commented Jul 2, 2023

swiftlang/swift#67070

@swift-ci please test Windows

@shahmishal
Copy link
Member

swiftlang/swift#67070

@swift-ci please test Windows

@hborla hborla merged commit 8828c29 into swiftlang:main Jul 3, 2023
@hborla hborla deleted the refine-extension-macros branch July 3, 2023 03:49
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.

3 participants