You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a limitation of how macro annotation expansion is implemented for scalac.
I'd like to detect situations when a user forgot to enable the macro paradise plugin and, as a result, their annotations have spuriously failed to expand. There's the @compileTimeOnly annotation that can be used for this, but unfortunately it not only produces errors on usages of macro annotations in annotation positions, but also on any kind of usages.
A better mechanism to address the original issue may enable us to be more permissive wrt other kinds of usages of macro annotations.
I have a macro annotation with parameters:
class AnnotationType(...) extends StaticAnnotation
. Sincec.prefix.tree
in the macro implementation is the tree for the annotation constructor, I've triedc.eval(c.Expr[AnnotationType](c.prefix.tree))
andc.eval(c.prefix.asInstanceOf[c.Expr[AnnotationType]]
.The compiler complains that it can't expand
AnnotationType
even though it isn't used as an annotation and shouldn't be expanded. If this worked, it would simplify http://stackoverflow.com/questions/32631372/getting-parameters-from-scala-macro-annotation and http://stackoverflow.com/questions/37891855/macro-annotation-with-default-arguments.The text was updated successfully, but these errors were encountered: