Skip to content

MemberAttributeMacro do not visit members that are guarded with IfConfigDecl #3106

Open
@jaredgrubb

Description

@jaredgrubb

Description

The MemberAttributeMacro does not get invoked for members that are inside #if guards.

Steps to Reproduce

Looking at the unit tests, I can add a new one to the MemberAttributeMacroTests:

  func testAttributeWithIfConfigDecl() {
    assertMacroExpansion(
      """
      @wrapAllProperties struct S {
        #if true
        var value = 1
        #endif
      }
      """,
      expandedSource: """
        struct S {
          #if true     
          @Wrapper
          var value = 1
          #endif
        }
        """,
      macros: ["wrapAllProperties": WrapAllProperties.self],
      indentationWidth: indentationWidth
    )
  }

Actual results is the macro never gets visited for value at all.

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

    Issue actions