Hello - I'm looking to use an extension macro to add functionality to a concrete type.
@attached(extension)
public macro Mock = #externalMacro(module: "PluginTarget", type: "MockMacro")
struct Mocker {}
@Mock
protocol Foo {}
// @Mock would add the following...
extension Mocker {
func mockFoo(_ type: Foo.Protocol) -> Foo {
// creates an instance of the given protocol
}
}
However, when I do so, I get the following warning:
⚠️ Extending a protocol composition is not supported; extending 'Foo' instead
Is there a way to specify that the extension macro will extend the Mocker
type instead of Foo
?