Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongBreak.kt
T
2015-10-14 20:39:35 +03:00

20 lines
623 B
Kotlin
Vendored

fun x(p: String): Boolean { return p == "abc" }
public fun foo(p: String?, r: String?, q: String?): Int {
while(true) {
q!!.length
loop@ do {
while(true) {
p!!.length
if (x(<!DEBUG_INFO_SMARTCAST!>p<!>)) break@loop
if (x(<!DEBUG_INFO_SMARTCAST!>q<!>)) break
}
} while (r == null)
if (!x(<!DEBUG_INFO_SMARTCAST!>p<!>)) break
}
// Long break allows r == null
r<!UNSAFE_CALL!>.<!>length
// Smart cast is possible
<!DEBUG_INFO_SMARTCAST!>q<!>.length
return <!DEBUG_INFO_SMARTCAST!>p<!>.length
}