why can't kotlin infer when an object is not null through the boolean in which it was checked? In this example, there should be no condition in which melons is null.
val berries = 13
val melons: String? = "big melons"
val condition: Boolean = berries >= 13 && melons != null
fun testerThing() { // compiles
if (berries >= 13 && melons != null) {
doSomething(melons)
}
}
fun testerThing2() { // doesn't compile
if (condition) {
doSomething(melons)
}
}