Closed
Description
Description
Conformance macros used in the input source are discarded without expansion. A basic example:
struct Conformance: ConformanceMacro {
public static func expansion(
of node: AttributeSyntax,
providingConformancesOf declaration: some DeclGroupSyntax,
in context: some MacroExpansionContext
) throws -> [(TypeSyntax, GenericWhereClauseSyntax?)] {
fatalError()
}
}
assertMacroExpansion("@Foo class Bar {}", expandedSource: "class Bar {\n}",
macros: ["Foo": Conformance.self])
This test passes despite the implementation being fatalError()
due to expansion(of:performanceConformanceOf:in:)
never being called. There appears to be two parallel implementations of macro expansion with ConformanceMacro only being supported in expandAttachedMacro(), which is not called by SyntaxProtocol.expand().
There may be other macro types not implemented as well; I did not try them all.
Steps to Reproduce
No response