‘when’ expression requires to be exhaustive, even be 'else' branch is empty
I have an enum with 7 states, also I have several ‘when’ statements:
when(state) {
States.state1 → doForState1
States.state2, Stetes.state3 → doForState2and3
} // generate error that I need add States 4,5,6,7 or else branch
As result, I added the else branch:
when(state) {
States.state1 → doForState1
States.state2, Stetes.state3 → doForState2and3
else → {} // do nothing
}
Early I had warnings only, but. Why I got the error after updating the version of Kotlin? Why compilator require an...