class Foo {
var x: Int? = null
}
fun fn(foo: Foo) {
if (foo.x == null)
return
foo.x += 5
// Smart cast to 'Int' is impossible, because 'foo.x' is a mutable property that could have been changed by this timekotlin(SMARTCAST_IMPOSSIBLE)
}
???
a
agrosner
04/14/2024, 3:04 AM
Correct. It’s a mutable property. += assumes the foo is non null