Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullAssignToSomething.kt
T
Dmitry Savvinov 99454aa78d Add test on smartcast from while-assigned var
Currently behavior is undesired, it will be fixed in the next commit
(see KT-27084)
2018-09-27 12:09:21 +03:00

9 lines
207 B
Kotlin
Vendored

fun main(args: Array<String>) {
var result: String? = null
var i = 0
while (result == null) {
if (i == 10) result = "non null"
else i++
}
result<!UNSAFE_CALL!>.<!>length
}