Quasi quotation leads to compiler error in Scala IDE but works fine with SBT

97 views
Skip to first unread message

Alexander Berger

unread,
Feb 18, 2014, 2:21:43 AM2/18/14
to scala-i...@googlegroups.com

Scala 2.11.0-M8
Scala IDE 4.0.0.m1-2_11-201401241152-b48fae2
Macro Paradise: 2.11.0-SNAPSHOT

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

}

Am I doing something wrong here or is this a bug in the Scala IDE?

Kind regards,
Alex

Rodrigo Cano

unread,
Oct 22, 2014, 10:08:22 AM10/22/14
to scala-i...@googlegroups.com
I'm still experiencing this. Any news?

Jason Zaugg

unread,
Oct 23, 2014, 2:38:55 AM10/23/14
to scala-i...@googlegroups.com
It seems to be a bug in the presentation compiler. I have lodged SI-8934 against the compiler to track this. I've reproduced this in a failing test case, but haven't identified the root cause yet.

-jason

Reply all
Reply to author
Forward
0 new messages