Can a macro call replace something on the right side of a member access?

Is "something.#whatever," where "whatever" is a macro call, legal? I'm wondering if there's some strange parsing rule banning having a member-period and macro-pound abut. I guess "#whatever2.someother" works just fine.

There is a parsing rule (I don't know if I'd call it strange though) that what appears on the right hand side of a . in a member access expression can only be a DeclReferenceExprSyntax, which is an identifier with optional parens and argument labels. So you can only have something like x.y or x.y(_:z:).

I would think that the second would work, not necessarily the first. For the second, wrapping the left macro in parentheses should work?

Macros are only allowed at top-level, so it doesn’t make sense to have member access refer to a macro. If anything it would make sense to module-qualify the macro but that is not currently supported. Do you have any code of what whatever2 would be in your example?