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

13 lines
296 B
Kotlin
Vendored

fun x(): Boolean { return true }
public fun foo(pp: String?): Int {
var p = pp
while(true) {
p!!.length
if (x()) break
(((p))) = null
}
// Smart cast is NOT possible here
// (we could provide it but p = null makes it much harder)
return p.length
}