The compiler knows that a Bool
has only 2 possible values, and that they are true
and false
. The compiler does not know that the ranges in your second switch cover all the possible values of Int. It has no special knowledge of the semantic meaning of Int.min
and Int.max
. They are just bit patterns, so far as the compiler is concerned.