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

36 lines
499 B
Kotlin
Vendored

fun foo(x: String) = x
fun test1() {
var c: Any? = "XXX"
if (c !is String) return
val newC: String? = "YYY"
if (newC != null) {
c = newC
}
foo(c)
}
fun test2() {
var c: Any? = "XXX"
if (c !is String) return
val newC: String? = "YYY"
if (newC is String) {
c = newC
}
foo(c)
}
fun test3() {
var c: Any? = "XXX"
if (c !is String) return
val newC: String? = "YYY"
if (newC == null) return
c = newC
foo(c)
}