Is there a way to pass a type identifier to a macro annotation? Here is what I mean:
@compileTimeOnly("Compile-time only annotation")
class mymacro(val typeName: universe.TypeName) extends StaticAnnotation { // <-- does not work
def macroTransform(annottees: Any*): Any = macro impl
}
object mymacro {
def impl(c: whitebox.Context)(annottees: c.Expr[Any]*) = //...
}
use-case:
trait SomeTrait
@mymacro(SomeTrait)
class Test {
//...
}
Or maybe there is any other way to pass Type identifier of an arbitrary non-generic type to a macro annotation implementation?
Motivation behind this: I need to generate some class Test
member function def foo
depending on the type passed as an argument to the macro annotation (SomeTrait
).