Smart cast to 'Type' is impossible, because 'variable' is a mutable property that could have been changed by this time
394
And the Kotlin newbie asks, "why won't the following code compile?":
var left: Node? = null
fun show() {
if (left != null) {
queue.add(left) // ERROR HERE
}
}
Smart cast to 'Node' is impossible, because 'left' is a mutable property that could have been changed by this time I get that
leftis mutable variable, but I'm explicitly checkingleft != nullandleftis of typeNodeso why can't it be smart-casted to that type? How can I fix this elegantly?