I have something like:
sealed trait Foo
case class Bar(field: ...) extends Foo
case class Baz(otherField: ...) extends Foo
trait JsonFormat {
implicit val barWrites = Json.writes[Bar]
implicit val barReads = Json.reads[Bar]
implicit val bazWrites = Json.writes[Baz]
implicit val bazReads = Json.reads[Baz]
implicit val fooWrites = Json.writes[Foo]
implicit val fooReads = Json.reads[Foo]
// other vals that depend on Foo
}
When I compile, I get an error like:
[error] /file/path/JsonFormat.scala:68:41: unreachable code
[error] implicit val fooWrites = Json.writes[Foo]
[error] ^
[error] one error found
I'm pretty new to scala and I understand an "unreachable code" error in the context of pattern matching, but I can't figure this one out.
I'm using play 2.8.