scala.meta annotation not recognised Follow
Scala.meta seems to be partially working, in that it seems to understand the basic quasi quotes in my example main app. However the annotation definition below will not compile - I get the error:
Error:(20, 10) ';' expected but 'def' found.
inline def apply(defn: Any): Any = meta {
I can't see anything significantly different between this and the example on the Scala.meta tutorial - this is a cutdown example for the posting here. IDEA even recognises that this is a 'meta program' and offers to compile it.
I'm using:
IDEA 2016.3.4 (build #UI-163.12024-16 - Jan31st)
Scala plugin (2016.3.8)
Scala 2.11.7
scalameta_2.11:1.4.0
jvm 1.8
Gradle 3.1 via IDEA
Have also tried EAP and Nightly builds
Any ideas how to get this working please?
dependencies {
compile 'org.scala-lang:scala-library:2.11.7'
}
dependencies {
compile group: 'org.scalameta', name: 'scalameta_2.11', version: '1.4.0'
}
My example program
package mymeta.test
import scala.annotation.StaticAnnotation
import scala.meta._
@mysync
class MySyncTest
object MetaTest extends App {
val x = q"x + y"
println(x)
}
class mysync extends StaticAnnotation {
inline def apply(defn: Any): Any = meta {
q"1 + 2"
}
}
Please sign in to leave a comment.
You are missing paradise plugin for Scala compiler, which is required to support the inline keyword.
Please try adding it with
Hi Mikhail,
There is no `scalaCompilerPlugin` configuration in gradle - the gradle scala plugin doesn't create one.
I have however managed to implement one, which results in the library being added to the scala SDK. But it assumes you're using nebula to recommend the scala version (or you'd have to write down the version yourself).