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

11 lines
318 B
Kotlin
Vendored

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