Skip to content

[Macros] Initial implementation of conformance macros. #63853

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

Conversation

hborla
Copy link
Member

@hborla hborla commented Feb 23, 2023

This change adds a new attached macro role for adding conformances, spelled @attached(conformance):

@attached(conformance)
macro Equatable() = #externalMacro(...)

@Equatable
struct S {}

Conformance macros are expanded as extensions at file scope. The above conformance macro application expands to:

extension S : Equatable {}

The auxiliary decl mechanism is used to visit these extensions alongside the original nominal type for type checking and SILGen.

@hborla
Copy link
Member Author

hborla commented Feb 23, 2023

swiftlang/swift-syntax#1356

@swift-ci please smoke test

@hborla
Copy link
Member Author

hborla commented Feb 23, 2023

@swift-ci please build toolchain

@ahoppen ahoppen removed their request for review February 23, 2023 13:56
@hborla hborla force-pushed the conformance-macros branch from 10bd2c2 to b47a93a Compare February 23, 2023 17:41
@hborla
Copy link
Member Author

hborla commented Feb 23, 2023

@swift-ci please smoke test

@hborla
Copy link
Member Author

hborla commented Feb 23, 2023

@swift-ci please build toolchain

@hborla hborla force-pushed the conformance-macros branch from b47a93a to a3caacd Compare February 24, 2023 04:43
@hborla
Copy link
Member Author

hborla commented Feb 24, 2023

swiftlang/swift-syntax#1360

@swift-ci please smoke test

@hborla
Copy link
Member Author

hborla commented Feb 24, 2023

swiftlang/swift-syntax#1360

@swift-ci please smoke test

@hborla hborla merged commit 84a89b2 into swiftlang:main Feb 24, 2023
@hborla hborla deleted the conformance-macros branch February 24, 2023 08:19
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.

1 participant