How do I access generic type in Macro Annotation in Scala? -


i have following code:

@compiletimeonly("enable macro paradise expand macro annotations") class typedtable[t] extends staticannotation {   def macrotransform(annottees: any*): table = macro tablegenerator.impl[t] }  object tablegenerator {   def impl[t](c: whitebox.context)(annottees: c.expr[any]*): c.expr[table] = {     import c.universe._     val tpe = weaktypeof[t]  // doesn't work     ...   } } 

and can't seem figure out how access typetag 't' in macro annotation. i've seen other posts make vague reference how can accessed can't seem figure out how i'm supposed access in context.

macro annotations don't typecheck arguments, means can trees these arguments, not types. in order obtain trees represent type arguments of macro annotation, call c.macroapplication , destructure appropriately.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -