Suppose the following scenario
sealed trait Status
case object Active extends Status
case object Inactive extends Status
@scala.deprecated("deprecated because reasons")
case object Disabled extends Status /
Considering Disabled object cannot be removed and given val status: Status = getStatus there is either one of this problems:
- Fails with match not exhaustive:
status match {
case Active => ???
case Inactive => ???
}
- Fails with deprecated value being used
status match {
case Active => ???
case Inactive => ???
case Disabled => ???
}
- Losing compile time safety
status match {
case Active => ???
case Inactive => ???
case _ => ???
}
Can type-safety exhaustive match be achieved in this scenario?