Skip to content

[Macros] Support module-qualified attached macro lookup #65863

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

Closed
wants to merge 1 commit into from

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented May 11, 2023

Allow attached macro expansion syntax to have a module qualifier, i.e. @Foo.Bar.

rdar://108621205

@rxwei
Copy link
Contributor Author

rxwei commented May 11, 2023

swiftlang/swift-syntax#1653

@swift-ci please smoke test

@DougGregor
Copy link
Member

This was explicitly discussed as part of the review of SE-0382 and rejected due to the syntactic ambiguity I pointed out.

Allow attached macro expansion syntax to have a module qualifier, `@Foo.Bar`.

rdar://108621205
@rxwei rxwei force-pushed the qualified-macro-108621205 branch from 446bf5c to 893f10b Compare May 11, 2023 18:57
@rxwei rxwei changed the title [Macros] Support module-qualified macro lookup [Macros] Support module-qualified attached macro lookup May 11, 2023
@rxwei
Copy link
Contributor Author

rxwei commented May 11, 2023

Reverted to just attached macros!

@rxwei rxwei requested a review from DougGregor May 11, 2023 19:01
@rxwei
Copy link
Contributor Author

rxwei commented May 11, 2023

@swift-ci please smoke test

@@ -8591,6 +8591,8 @@ class MacroDecl : public GenericContext, public ValueDecl {
/// declaration/expression nodes.
struct MacroExpansionInfo : ASTAllocated<MacroExpansionInfo> {
SourceLoc SigilLoc;
DeclNameRef ModuleName;
Copy link
Contributor Author

@rxwei rxwei May 11, 2023

Choose a reason for hiding this comment

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

There's no syntactic change to macro expansion exprs/decls, but these two fields were added so that attached macros can continue to use the same code path in the constraint system to resolve macro refs.

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