JVM_IR: add local delegated property metadata to non-synthetic classes

Otherwise kotlin-reflect won't find it (and it won't even be serialized
anyway).

 #KT-42562 Fixed
This commit is contained in:
pyos
2020-10-09 09:37:35 +02:00
committed by Alexander Udalov
parent 2974004de4
commit 1663619606
7 changed files with 103 additions and 20 deletions
@@ -0,0 +1,11 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.*
inline operator fun String.getValue(t:Any?, p: KProperty<*>): String =
if (p.returnType.classifier == String::class) this else "fail"
fun box() = {
val x by "OK"
x
}()
@@ -0,0 +1,20 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// WITH_REFLECT
// FILE: 1.kt
package test
import kotlin.reflect.*
inline operator fun String.getValue(t:Any?, p: KProperty<*>): String =
if (p.returnType.classifier == String::class) this else "fail"
inline fun foo(crossinline f: () -> String) = {
val x by f()
x
}()
// FILE: 2.kt
import test.*
fun box() = foo { "OK" }