1

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?

user1063042
  • 273
  • 2
  • 11
  • I did some experimentation with sbt and was able to get that to work as expected. But our build process is really not amenable to using sbt, so I'd really like to be able to get this work with the command-line. – user1063042 Dec 11 '18 at 22:09
  • I just discovered this open issue: https://github.com/scalamacros/paradise/issues/106 – user1063042 Dec 12 '18 at 02:57
  • Given that there has been no progress on that issue in over a year, I think my only hope is that with 2.13 very close to release, I can reasonably switch to developing on 2.13 (which is supposed to have paradise built in) and hope that will resolve my issue. – user1063042 Dec 12 '18 at 02:59
  • Oh and then there is also https://github.com/scalamacros/paradise/issues/99. So clearly the developers must only ever use sbt. – user1063042 Dec 12 '18 at 03:00
  • It looks like using ` -Ymacro-annotations` on 2.13-M5 works fine, so I guess I'll have to see how difficult upgrading proves to be. – user1063042 Dec 12 '18 at 03:13

1 Answers1

0

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.

Perl99
  • 73
  • 5