There are some issues about better exhaustiveness checking (without when-with-subject). So I think when conditions on local vals is your answer, with exhaustiveness and smart cast improvements over the horizon:
https://youtrack.jetbrains.com/issue/KT-63696/Improved-exhaustiveness-checking
> Another use case where the current matching is not good enough is when the condition depends on more than one variable. This is very common in combination with nullability:
>
val x: A? = thingThatMayReturnNull()
val y: B? = thingThatAlsoMayReturnNull()
when {
x == null && y == null -> ...
x != null -> ...
}