Retain data flow info after elvis operator
#KT-2825 In Progress
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user