[FIR] Fix false-positive smartcast on receiver in rhs of elvis

#KT-44942 Fixed
This commit is contained in:
Dmitriy Novozhilov
2021-02-15 17:23:16 +03:00
parent 2b39282682
commit dfcff132fd
10 changed files with 70 additions and 6 deletions
+19
View File
@@ -0,0 +1,19 @@
// ISSUE: KT-44942
abstract class A {
abstract fun foo(): String
}
class B : A() {
override fun foo(): String = "fail"
fun bar() = "fail"
}
class C : A() {
override fun foo(): String = "OK"
}
fun A.test() = (this as? B)?.bar() ?: foo()
fun box() = C().test()