[KLIB] Make sure that referenced local anonymous class is deserialzied.

In case if such class is used an type argument for field type make sure
that field initializer is being read.

Check type recursively.

- fix KT-41143
- update test
This commit is contained in:
Roman Artemev
2020-11-05 16:29:02 +03:00
parent 0dd329d3d4
commit 8ca9e792e9
2 changed files with 28 additions and 10 deletions
+17 -1
View File
@@ -1,3 +1,4 @@
// WITH_RUNTIME
// MODULE: lib
// FILE: lib.kt
@@ -51,6 +52,16 @@ object FunTest {
fun bbb() = qqq().biq().also { it.caz() }
}
object DelegateTest {
var result = ""
val f by lazy {
object { }.also { result += "OK" }
}
fun bbb() = f
}
// MODULE: lib2(lib)
// FILE: lib2.kt
fun test1(): String {
@@ -62,11 +73,16 @@ fun test2(): String {
return FunTest.result
}
fun test3(): String {
DelegateTest.bbb()
return DelegateTest.result
}
// MODULE: main(lib2)
// FILE: main.kt
fun box(): String {
if (test1() != "!abcd") return "FAIL 1: ${test1()}"
if (test2() != "zyxw") return "FAIL 2: ${test2()}"
return "OK"
return test3()
}