Scala pureconfig密封系列杀死了REPL中的编译器

时间:2018-07-29 09:28:48

标签: scala typeclass pureconfig

我与https://pureconfig.github.io/docs/overriding-behavior-for-sealed-families.html

一起关注
import com.typesafe.config.ConfigFactory
import pureconfig._

sealed trait Season
case object Spring extends Season
case object Summer extends Season
case object Autumn extends Season
case object Winter extends Season

implicit val seasonHint = new EnumCoproductHint[Season]

case class MyConf(list: List[Season])

loadConfig[MyConf](ConfigFactory.parseString("{ list: [spring, summer, autumn, winter] }"))

但这失败了:

That entry seems to have slain the compiler.  Shall I replay
your session? I can re-run each line except the last one.
[y/n]

在REPL中执行时。

Scala版本应为2.11.12。但是,由于代码是在spark 2.2中执行的,因此使用https://github.com/apache/spark/blob/v2.2.2/pom.xml#L159 scala 2.11.8。

编辑

Types$TypeError: value <none> is not a member of $line23.$read

https://gist.github.com/geoHeil/6470acd6e2bdc1b1894d14b385d65110

注意,我使用gradle和scala插件。 Scala反射的完整类路径为https://gist.github.com/geoHeil/caf00b96c931563ae2a1223f44a14497

0 个答案:

没有答案