PSI/FIR->IR translators: return to 1.7.10 behavior for field references

In 1.7.20 we used the nearest Java-based receiver for such field
references in backend. Now we are using use-site receiver again,
it can lead to accidental usage of derived class property backing field.

This is effectively a revert of KT-49507 fix, see commits:
- fa914f20
- b0a6508d

#KT-54393 Fixed
#KT-49507 Planned
#KT-52338 Planned
This commit is contained in:
Mikhail Glukhikh
2022-10-21 16:08:56 +02:00
committed by Space Team
parent 14213ddad2
commit c0789b5207
20 changed files with 62 additions and 157 deletions
@@ -13,14 +13,14 @@ class C : B {
fun f(): @FlexibleNullability String? {
return eval<@FlexibleNullability String?>(f = local fun <anonymous>(): @FlexibleNullability String? {
return <this>(super<B>).#x
return <this>.#x
}
)
}
fun g(): @FlexibleNullability String? {
return eval<@FlexibleNullability String?>(f = local fun <anonymous>(): @FlexibleNullability String? {
return <this>(super<B>).#y
return <this>.#y
}
)
}
@@ -13,14 +13,14 @@ class C : B {
fun f(): @FlexibleNullability String? {
return eval<@FlexibleNullability String?>(f = local fun <anonymous>(): @FlexibleNullability String? {
return <this>(super<B>).#x
return <this>(super<C>).#x
}
)
}
fun g(): @FlexibleNullability String? {
return eval<@FlexibleNullability String?>(f = local fun <anonymous>(): @FlexibleNullability String? {
return <this>(super<B>).#y
return <this>(super<C>).#y
}
)
}
@@ -55,7 +55,7 @@ fun test(b: Boolean) {
else -> d2
}
k.#f = 42
k(super<JFieldOwner>).#f /*~> Unit */
k.#f /*~> Unit */
val md1: DerivedThroughMid1 = DerivedThroughMid1()
val md2: DerivedThroughMid2 = DerivedThroughMid2()
val mk: Mid = when {
@@ -63,6 +63,6 @@ fun test(b: Boolean) {
else -> md2
}
mk.#f = 44
mk(super<JFieldOwner>).#f /*~> Unit */
mk.#f /*~> Unit */
}
@@ -63,6 +63,6 @@ fun test(b: Boolean) {
else -> md2
}
mk /*as Mid */(super<Mid>).#f = 44
mk /*as Mid */(super<JFieldOwner>).#f /*~> Unit */
mk /*as Mid */(super<Mid>).#f /*~> Unit */
}
@@ -10,7 +10,7 @@ class Derived : Base {
}
fun getValue(): Int {
return <this>(super<Base>).#value
return <this>.#value
}
fun setValue(value: Int) {
@@ -10,7 +10,7 @@ class Derived : Base {
}
fun getValue(): Int {
return <this>(super<Base>).#value
return <this>(super<Derived>).#value
}
fun setValue(value: Int) {