除了WeakTypeTag证据之外,宏实现不能具有隐式参数

时间:2017-12-15 07:46:41

标签: scala

我正在使用:Scala 2.12.4。使用以下代码:

implicit class RichInFix[T](body: => T) {
  def toEither[E <: MyType]: Either[E, T] = macro Macros.toEitherImpl
}

object Macros {
  def toEitherImpl[E : WeakTypeTag, T : WeakTypeTag](c: blackbox.Context): c.Expr[Either[E, T]] = ???
}

我收到以下编译错误:macro implementations cannot have implicit parameters other than WeakTypeTag evidences

我无法看出我是否出错了,E&amp; T是WeakTypeTags - 任何想法?

0 个答案:

没有答案
相关问题