K2: fix property VS field resolve in anonymous class case

Related to KT-55017, KT-50082
This commit is contained in:
Mikhail Glukhikh
2023-01-11 19:56:29 +01:00
committed by teamcity
parent 6a6308bef2
commit f20e5daa92
7 changed files with 79 additions and 1 deletions
@@ -0,0 +1,29 @@
FILE: test.kt
public final fun box(): R|kotlin/String| {
lval x: R|<anonymous>| = object : R|base/Jaba| {
private constructor(): R|<anonymous>| {
super<R|base/Jaba|>()
}
private final val a: R|kotlin/String| = String(OK)
private get(): R|kotlin/String|
local final inner class S : R|kotlin/Any| {
public <anonymous>.constructor(): R|<anonymous>.S| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/String| {
^foo this@R|/<anonymous>|.R|/<anonymous>.a|
}
}
public final fun bar(): R|kotlin/String| {
^bar this@R|/<anonymous>|.R|/<anonymous>.S.S|().R|<local>/foo|()
}
}
^box R|<local>/x|.R|/<anonymous>.bar|()
}
@@ -0,0 +1,25 @@
// FILE: Jaba.java
package base;
public class Jaba {
protected String a = "FAIL";
}
// FILE: test.kt
import base.Jaba
fun box(): String {
val x = object : Jaba() {
private val a: String = "OK"
inner class S {
// Should be resolved to a property
fun foo() = a
}
fun bar() = S().foo()
}
return x.bar()
}