bug icon indicating copy to clipboard operation
bug copied to clipboard

Macro annotation doesn't attempt to alert to missing compiler configuration

Open som-snytt opened this issue 4 years ago • 1 comments

reproduction steps

Using Scala 2.13.7, omitting -Ymacro-annotations when compiling either the macro or its usage/expandage fails silently to expand.

problem

Since paradise was ingested, the compiler could complain if an annotation with a macroExpand method is compiled without the required compiler configuration.

Inspired by #12498

som-snytt avatar Nov 28 '21 06:11 som-snytt

In which the doc says "aforementioned":

First of all, note the @compileTimeOnly annotation. It is not mandatory, but is recommended to avoid confusion. Macro annotations look like normal annotations to the vanilla Scala compiler, so if you forget to enable the macro paradise plugin in your build, your annotations will silently fail to expand. The @compileTimeOnly annotation makes sure that no reference to the underlying definition is present in the program code after typer, so it will prevent the aforementioned situation from happening.

som-snytt avatar Nov 28 '21 07:11 som-snytt