I've started learning Scala.
I was surprised that next code compiles:
object Hello extends App {
def isOne(num: Int) = num match {
case 1 => "hello"
}
}
You can't do something similar in Rust for example.
Why Scala compiler does not force me to provide default value for case ?
I'd say that it is a little bit unsafe.
Is there any scala linter or something else? Maybe some flags?
Since Scala 2.13.4 there were improvement to exhaustivity checking of unsealed types such as
Intso try with compiler flagfor example
In general though, according to Pattern Matching Expressions