I’m in the process of upgrading from Scala 2.13.3 to 2.13.4. The most conspicuous change there is the tightening of exhaustivity checks, and most of those are straightforward. But I’m a bit stumped by this one.
I have a couple of blocks of code that are roughly:
json \ "thingy" match {
case JsDefined(tpe) => tpe match {
...
}
case JsUndefined() => ... error value here
}
The Scala compiler is kicking out “match may not be exhaustive. It would fail on the following input: JsUndefined()
”. Which is odd on the face of it, and I’m puzzled – there’s nothing obviously wrong with the definition of JsUndefined.unapply()
. (It’s a little odd that it takes Object
instead of JsLookupResult
, but it looks like it should work.)
I found this on play-json 2.9.2, but it still seems to be true on 2.10.0-RC5.
Any thoughts? I can attach @unchecked
to the match if need be, but the mystery is rankling.