[FIR] Fix false-positive smartcast on receiver in rhs of elvis
#KT-44942 Fixed
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user