Retain data flow info after elvis operator

#KT-2825 In Progress
This commit is contained in:
Alexander Udalov
2012-11-12 18:49:07 +04:00
parent e4cd0e004f
commit d19a824b14
3 changed files with 25 additions and 4 deletions
@@ -0,0 +1,14 @@
fun foo(x: Int?): Int = x!!
fun elvis(x: Number?): Int {
val result = (x as Int?) ?: foo(x)
x : Int?
return result
}
fun elvisWithRHSTypeInfo(x: Number?): Any? {
val result = x ?: x!!
<!TYPE_MISMATCH!>x<!> : Int?
return result
}