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

11 lines
356 B
Kotlin
Vendored

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