com-lihaoyi / upickle

uPickle: a simple, fast, dependency-free JSON & Binary (MessagePack) serialization library for Scala
https://com-lihaoyi.github.io/upickle
MIT License
707 stars 158 forks source link

`ujson.Bool.unapply` generates `match may not be exhaustive` warning #456

Closed lolgab closed 1 year ago

lolgab commented 1 year ago

The following code:

ujson.Bool(true) match {
  case ujson.Bool(v) =>
}

generates the following warning:

ujson.Bool(true) match {
^^^^^^^^^^^^^^^^
match may not be exhaustive.

It would fail on pattern case: False, True

The problem is in the unapply signature:

def unapply(bool: Bool): Option[Boolean] = Some(bool.value)

should instead be:

def unapply(bool: Bool): Some[Boolean] = Some(bool.value)
lolgab commented 1 year ago

To be able to test this we need to enable -Xfatal-warnings so I opened #457 to do that.