EDIT
This has already been discussed here and there is an open issue for it.
Consider the following code for handing a nullable variable:
var sample: String? = ...;
sample?.let {
it.toUpperCase()
} ?: run { fetchAnotherString() }
As far as I know, this is the best way to have two branches with a nullable variable, but I think this would be much better:
when (sample) {
!null -> it.toUpperCase()
else -> fetchAnotherString()
}
Are there limitations preventing this from being possible?