The following Scala code, which uses quasi quotations compiles perfectly using SBT but leads to a compiler error in the Scala IDE (see
the highlighted source code and comments below). Please note this is just a reduced code snippet to reproduce the problem.
import scala.annotation.StaticAnnotation
import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
private class IDMacro(val c: Context) {
import c._
def impl2(annottees: Expr[Any]*): Expr[Any] = {
import universe._
val inputs = annottees.map(_.tree).toList
inputs.head match {
// The following line compiles perfectly using SBT but leads to the following
// compiler error in Scala-IDE (4.0.0.m1-2_11-201401241152-b48fae2):
// too many patterns for trait api: expected 1, found 9
case q"$flags class $className[..$tp] $cFlags(...$args) extends {..$early} with ..$parents {$self => ..$stats}" =>
()
}
c.Expr[Any](Block(inputs, Literal(Constant(()))))
}
}
final class ID extends StaticAnnotation {
def macroTransform(annottees: Any*): Any = macro IDMacro.impl
}