Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.kt
T
2021-01-29 16:55:26 +03:00

12 lines
315 B
Kotlin
Vendored

// FIR_IDENTICAL
fun x(): Boolean { return true }
public fun foo(p: String?): Int {
while(true) {
if (x()) break
// We do not always reach this statement
p!!.length
}
// Here we have while (true) loop but p is nullable due to break before
return p<!UNSAFE_CALL!>.<!>length
}