Fix check for local classes in approximating string table

Take local/anonymous classes and their inner classes into account.
Simplify approximation: use first available super classifier instead
of first super class. This approximation should only happen for
private declarations that were not previously approximated by frontend.
So basically the only requirement for the approximated types is to be
denotable. Note that this only works if the types are not used later.
JVM uses a different string table implementatin as it needs exact
types of private members for reflection.

^KT-20996 Fixed
This commit is contained in:
Pavel Kirpichenkov
2021-01-18 19:52:15 +03:00
parent b66f5c8180
commit 5c28762c02
6 changed files with 106 additions and 15 deletions
@@ -39,6 +39,32 @@ class C {
fun x() = "OK"
}
private val propOI = object {
inner class D {
fun df() {}
}
fun d(): D = D()
}.d()
private val propL = run {
class L {
fun l() = "propL.l"
}
L()
}
private val propL2 = run {
class L {
inner class L1 {
inner class L2 {
fun l2() = "propL2.l2"
}
}
}
L().L1().L2()
}
}
// MODULE: main(lib)
@@ -48,4 +74,7 @@ fun test() {
println(C().<!INVISIBLE_MEMBER!>propI<!>.x())
println(C().<!INVISIBLE_MEMBER!>propAI<!>.x())
println(C().<!INVISIBLE_MEMBER!>propG<!>.x())
}
println(C().<!INVISIBLE_MEMBER!>propOI<!>.df())
println(C().<!INVISIBLE_MEMBER!>propL<!>.l())
println(C().<!INVISIBLE_MEMBER!>propL2<!>.l2())
}