FIR2IR: Fix complex cases of smart cast expressions used as dispatch receiver
It might be not only <ExpressionWithSmartCast>(a).foo(), but also id(<ExpressionWithSmartCast>(a)).foo() and many other cases
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
abstract class A {
|
||||
abstract fun o(): String
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun k(): String
|
||||
}
|
||||
|
||||
fun <T> id(x: T): T = x
|
||||
|
||||
fun foo(a: A?): String {
|
||||
if (a is B) {
|
||||
return id(a).o() + a!!.k()
|
||||
}
|
||||
|
||||
return "fail"
|
||||
}
|
||||
|
||||
class Impl : A(), B {
|
||||
override fun o(): String = "O"
|
||||
override fun k(): String = "K"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return foo(Impl())
|
||||
}
|
||||
Reference in New Issue
Block a user