Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt
T
Dmitriy Novozhilov 6735cc8937 [FIR] Implement new bound smartcast algorithm
#KT-36055 Fixed
2020-02-12 10:17:45 +03:00

21 lines
394 B
Kotlin
Vendored

// !LANGUAGE: -SoundSmartcastFromLoopConditionForLoopAssignedVariables
fun foo() {
var x: String? = "123"
while (x!!.length < 42) {
x = null
break
}
x.length // 'x' is unsoundly smartcasted here
}
fun bar() {
var x: List<Int>? = ArrayList<Int>(1)
for (i in x!!) {
x = null
break
}
x.size // 'x' is unsoundly smartcasted here
}