sealed case class ImportType(name: String)
implicit val importTypeRW: upickle.default.ReadWriter[ImportData.ImportType] =
upickle.default.macroRW
[error] /Users/lihaoyi/Github/Ammonite/amm/runtime/src/main/scala/ammonite/runtime/Storage.scala:114:21: exception during macro expansion:
[error] java.lang.UnsupportedOperationException: empty.max
[error] at scala.collection.IterableOnceOps.max(IterableOnce.scala:1127)
[error] at scala.collection.IterableOnceOps.max$(IterableOnce.scala:1124)
[error] at scala.collection.AbstractIterable.max(Iterable.scala:935)
[error] at upickle.implicits.internal.Macros$DeriveDefaults.annotate(Macros.scala:231)
[error] at upickle.implicits.internal.Macros$DeriveDefaults.annotate$(Macros.scala:209)
[error] at upickle.implicits.internal.Macros$Reading.annotate(Macros.scala:278)
[error] at upickle.implicits.internal.Macros$DeriveDefaults.deriveClass(Macros.scala:203)
[error] at upickle.implicits.internal.Macros$DeriveDefaults.deriveClass$(Macros.scala:160)
[error] at upickle.implicits.internal.Macros$Reading.deriveClass(Macros.scala:278)
[error] at upickle.implicits.internal.Macros$DeriveDefaults.derive(Macros.scala:115)
[error] at upickle.implicits.internal.Macros$DeriveDefaults.derive$(Macros.scala:109)
[error] at upickle.implicits.internal.Macros$Reading.derive(Macros.scala:278)
[error] at upickle.implicits.internal.Macros$.macroRImpl(Macros.scala:473)
[error] upickle.default.macroRW
[error] ^
Fails on most Scala versions. It seem sealed is confusing the macro into thinking it's a sealed trait, and then when it finds no case class or case object children it crashes
Workaround is to remove the sealed, but really we should just not crash
Fails on most Scala versions. It seem
sealed
is confusing the macro into thinking it's asealed trait
, and then when it finds nocase class
orcase object
children it crashesWorkaround is to remove the
sealed
, but really we should just not crash