Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/variables/ifElseBlockInsideDoWhile.fir.kt
T
2020-02-03 16:45:20 +03:00

15 lines
322 B
Kotlin
Vendored

public fun foo(xx: Any): Int {
var x = xx
do {
var y: Any
// After the check, smart cast should work
if (x is String) {
y = "xyz"
} else {
y = "abc"
}
// y!! in both branches
y.length
} while (!(x is String))
return x.length
}