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)