FIR: Fix case when smartcast receiver is used for call to private method

^KT-54432 Fixed
This commit is contained in:
Denis.Zharkov
2022-05-27 16:07:38 +03:00
committed by teamcity
parent ccc32b4e3b
commit c1904004c4
20 changed files with 306 additions and 27 deletions
@@ -0,0 +1,16 @@
open class Base {
fun foo(): String {
return when (this) {
is Derived -> baz()
else -> "fail 1"
}
}
private fun baz(): String = "OK"
}
class Derived : Base()
fun box(): String {
return Derived().foo()
}
+21
View File
@@ -0,0 +1,21 @@
abstract class Base {
fun foo(): String {
return when (this) {
is Derived -> baz()
else -> "fail 1"
}
}
abstract fun bar(): String
private fun Derived.baz(): String = bar() + k
}
class Derived : Base() {
override fun bar(): String = "O"
val k: String get() = "K"
}
fun box(): String {
return Derived().foo()
}