0

I tried to implement scala-meta inline / meta style macro annotation in a scala-maven project. I'm getting following error in the compilation.

[ERROR] /home/tiran/.../validatable.scala:12: ';' expected but 'def' found.
[ERROR]   inline def apply(defn: Any): Any = meta {
[ERROR]          ^

Do we need additional compiler plugin for scala meta to work or, am I missing something here? By the way scalameta dependency is the only dependency i have added. My scala version is 2.11

tiran
  • 2,389
  • 1
  • 16
  • 28

1 Answers1

1

From https://github.com/scalameta/sbt-macro-example/blob/master/build.sbt:

// A dependency on macro paradise 3.x is required to both write and expand
// new-style macros.  This is similar to how it works for old-style macro
// annotations and a dependency on macro paradise 2.x.
addCompilerPlugin("org.scalameta" % "paradise" % "3.0.0-M7" cross CrossVersion.full),
scalacOptions += "-Xplugin-require:macroparadise",

So you need to add the Maven equivalent.

Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
  • 1
    Correct, the scalameta paradise compiler plugin can be enabled by passing `-Xplugin:/path/to/scameta/paradise.jar` to scalac, that's essentially what addCompilerPlugin does in sbt. – Ólafur Páll Geirsson Apr 14 '17 at 22:31