I have these three macros all defined in the same file (and with the same exact definition):
class client(val port: Int = 9000) extends StaticAnnotation {
def macroTransform(annottees: Any*): Any = macro ClientGen.mkClient
}
class grpcMock(val port: Int = 9000) extends StaticAnnotation {
def macroTransform(annottees: Any*): Any = macro ClientGen.mkClient
}
class foo(val port: Int = 9000) extends StaticAnnotation {
def macroTransform(annottees: Any*): Any = macro ClientGen.mkClient
}
There are absolutely no differences between them other than the names ... However:
@client object Fooworks fine@grpcMock object Foofails withnot found type: grpcMock@foo object Foofails withinvalid annotation new foo()
I am lost :( Does anyone have an idea what can be wrong here?
Basically, all annotations I had in that file before today, still work. Any new one I try to add complains about invalid annotation unless it's name looks like grpcMock, in which case it says "type not found". What's going on here???
sbt clean compile(for subproject with macro annotations and subproject withFoo)? Do you have reproduction? What isClientGen.mkClient?scalacOptions += "-Ymacro-debug-lite"to see how macros are expanded. What is the output upon compilation?@compileTimeOnly("Enable macro annotations")to make sure that they are expanded during compilationclient). Sorry for sending you on the wild goose chase :( I was sure that I replaced it with noop, but ... I haven't :( The "type not found" error was real though. I'll post an answer to explain in case you are curious.