Skip to content

MacroSystem should handle fully qualified macro name #2874

@ApolloZhu

Description

@ApolloZhu
Contributor

Description

When unit testing macro expansions using SwiftSyntaxMacroExpansion, there's no way for it to expand fully qualified attached macro

let attributeName = attribute.attributeName.as(IdentifierTypeSyntax.self)?.name.text,

Steps to Reproduce

Try to write a unit test that expands a fully qualified attached macro:

@MyModule.MyMacro var hello = "world"

Neither of the following in the dictionary works with the SyntaxProtocol.expand function

[
    "MyMacro": MyMacro.self,
    "MyModule.MyMacro": MyMacro.self,
]

Activity

ApolloZhu

ApolloZhu commented on Oct 6, 2024

@ApolloZhu
ContributorAuthor

Tracked in Apple’s issue tracker as rdar://137364509

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ApolloZhu

        Issue actions

          MacroSystem should handle fully qualified macro name · Issue #2874 · swiftlang/swift-syntax