Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/varnotnull/iterations.fir.kt
T

14 lines
305 B
Kotlin
Vendored

data class SomeObject(val n: SomeObject?) {
fun doSomething() {}
fun next(): SomeObject? = n
}
fun list(start: SomeObject) {
var e: SomeObject? = start
while (e != null) {
// While condition makes both smart casts possible
e.doSomething()
e = e.next()
}
}