鉴于shapeless type class derivation example (with Show
)。
如果有案例对象,如何使其适应工作:
case object Snafu extends Super
目前在宏扩展期间无法编译异常:
scala.ScalaReflectionException: <none> is not a term
at scala.reflect.api.Symbols$SymbolApi$class.asTerm(Symbols.scala:199)
at scala.reflect.internal.Symbols$SymbolContextApiImpl.asTerm(Symbols.scala:79)
at shapeless.GenericMacros$Helper$class.mkTransCase(generic.scala:394)
at shapeless.GenericMacros$$anon$2.mkTransCase(generic.scala:122)
at shapeless.GenericMacros$Helper$class.mkToReprCase(generic.scala:411)
at shapeless.GenericMacros$$anon$2.mkToReprCase(generic.scala:122)
at shapeless.GenericMacros$Helper$$anonfun$19.apply(generic.scala:573)
at shapeless.GenericMacros$Helper$$anonfun$19.apply(generic.scala:573)
at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:54)
at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:53)
at scala.collection.immutable.List.map(List.scala:272)
at shapeless.GenericMacros$Helper$class.mkCases(generic.scala:338)
at shapeless.GenericMacros$$anon$2.mkCases(generic.scala:122)
at shapeless.GenericMacros$Helper$class.deriveInstance(generic.scala:573)
at shapeless.GenericMacros$$anon$2.deriveInstance(generic.scala:122)
at shapeless.GenericMacros$.deriveInstanceAux(generic.scala:131)
at shapeless.GenericMacros$.deriveLabelledInstance(generic.scala:117)
implicit val showInstance = Show[Super]
^
答案 0 :(得分:1)
刚从Twitter上的Miles那里得到答案: https://twitter.com/milessabin/status/541954842076659712
很快就会解决。