play-json-derived-codecs icon indicating copy to clipboard operation
play-json-derived-codecs copied to clipboard

Possible to improve error message in case object hierarchy isn't sealed?

Open Woodz opened this issue 7 years ago • 0 comments

Currently, the compiler error message produced in case the ADT hierarchy isn't fully sealed is not very self-explanatory. It would be great if this could be improved to help users debug issues faster.

For example (note that SuperFoo is not sealed): `sealed trait Foo

trait SuperFoo extends Foo

case class Bar(x: Int) extends Foo

case class Baz(s: String) extends SuperFoo

case object Bah extends Foo

implicit val fooFormat: OFormat[Foo] = flat.oformat((__ \ "type").format[String]) `

Fails to compile with: Error:(16, 58) could not find Lazy implicit value of type julienrf.json.derived.DerivedReads[A] Error occurred in an application involving default arguments. lazy implicit val fooFormat: OFormat[Foo] = flat.oformat((__ \ "type").format[String]) ^ which is not obviously caused by an unsealed ADT hierarchy

Woodz avatar Aug 18 '17 09:08 Woodz