Does macroparadise no longer work from the command line?

96 Views Asked by At

I am trying to start using the paradise macro plugin, so I have been beginning with the identity macro example from:

https://docs.scala-lang.org/overviews/macros/annotations.html

However, when I try to use the identity annotation I get

error: enable macro paradise to expand macro annotations

As you would expect if the plugin isn't loaded. However, I am following the instructions from

https://docs.scala-lang.org/overviews/macros/paradise.html

But when I invoke:

scalac -Xplugin:paradise_2.12.8-2.1.1.jar -Xshow-phases

I do not see the macroparadise phase:

    phase name  id  description
    ----------  --  -----------
        parser   1  parse source into ASTs, perform simple desugaring
         namer   2  resolve names, attach symbols to named trees
packageobjects   3  load package objects
         typer   4  the meat and potatoes: type the trees
        patmat   5  translate match expressions
        ...

However, if I instead do

scalac -Xplugin:paradise_2.12.8-2.1.1.jar -Xplugin-list

I get

macroparadise - Empowers production Scala compiler with latest macro developments

So I really confused as to what step I'm missing here? Is there some new command-line argument I'm missing? Is using sbt required?

1

There are 1 best solutions below

0
On

It seems to be some developer oversight, but the plugin is working this way in my case - I use scala-maven-plugin and this maven plugin uses command line call to new java process.

Both symptoms are present: -Xplugin-list shows the plugin and -Xshow-phases does not show any changes

Note that you need to use separate subproject / submodule with macros, they can only be used after they are compiled.