Scala 2.10.4:在解析这个quasiquote时,抛出异常

时间:2015-04-15 08:49:00

标签: scala-quasiquotes

        q"""
        val x = ${evalA.primitiveTerm}
        val y = ${evalB.primitiveTerm}
        val res = 0
        for (i <- 0 until x.length; if i < y.length) {
          val res = x(i).compareTo(y(i))
          if (res != 0) return res
        }
        return x.length - y.length
        """

当我执行上面的代码时,我得到以下错误

Error:(49, 13) exception during macro expansion: 
java.lang.UnsupportedOperationException: Position.end on class scala.reflect.internal.util.OffsetPosition
    at scala.reflect.internal.util.Position.end(Position.scala:126)
    at scala.quasiquotes.TreeGen.closurePos$1(TreeGen.scala:670)
    at scala.quasiquotes.TreeGen.mkFor(TreeGen.scala:677)
    at scala.quasiquotes.TreeGen.mkFor(TreeGen.scala:682)
    at org.scalamacros.paradise.parser.Parsers$Parser.parseFor$1(Parsers.scala:1445)

0 个答案:

没有答案