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
@@ -29,6 +29,32 @@ private val o8 = object : G<Int>() {}
private val o9 = object : G<Int>(), I1, I2 {}
private val o10 = object : G<Int>(), I3 {}
private val o11 = object {
inner class D {
fun df() {}
}
fun d(): D = D()
}.d()
private val o12 = {
class L {
fun l() {}
}
L()
}()
private val o13 = {
class L {
inner class L1 {
inner class L2 {
fun l2() {}
}
}
}
L().L1().L2()
}()
fun fn() {
o1.foo()
o2.i1()
@@ -50,6 +76,9 @@ fun fn() {
o10.g()
o10.i1()
o10.i2()
o11.df()
o12.l()
o13.l2()
}
class W {