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

11 lines
371 B
Kotlin
Vendored

public fun foo(x: String?, y: String?): Int {
while (true) {
val z = (if (y == null) break else x) ?: <!DEBUG_INFO_SMARTCAST!>y<!>
// z is not null in both branches
z.length
// y is not null in both branches
<!DEBUG_INFO_SMARTCAST!>y<!>.length
}
// y is null because of the break
return y<!UNSAFE_CALL!>.<!>length
}