I see your point but actually it is not that easy. It is not just a smart cast problem. when
statement is smart casting the parameter it gets, but then you don’t have a way to refer that parameter whenever you use an expression there.
The solution comes to my mind is to be able to access to the parameter of when
with a keyword like it
. then instead of using value
you can use it
on the right hand side of any when
condition.