More correct handling of possible type set during assignment #KT-8229 Fixed

This commit is contained in:
Mikhail Glukhikh
2015-11-02 17:25:44 +03:00
parent bbea70a005
commit 03aaddd379
4 changed files with 48 additions and 1 deletions
@@ -0,0 +1,35 @@
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(<!DEBUG_INFO_SMARTCAST!>c<!>)
}
fun test2() {
var c: Any? = "XXX"
if (c !is String) return
val newC: String? = "YYY"
if (newC is String) {
c = newC
}
foo(<!DEBUG_INFO_SMARTCAST!>c<!>)
}
fun test3() {
var c: Any? = "XXX"
if (c !is String) return
val newC: String? = "YYY"
if (newC == null) return
c = newC
foo(<!DEBUG_INFO_SMARTCAST!>c<!>)
}