[JVM IR] Interface Delegation by Property should use existing field

When a property backed by a final field is the delegate for interface
implementation by delegation, the backend should reuse the backing
field rather than introduce a new, extraneous `$$delegate_n` field.
This commit is contained in:
Kristoffer Andersen
2020-01-29 16:22:23 +01:00
committed by Dmitry Petrov
parent d4170bca6e
commit 61e6d346aa
2 changed files with 19 additions and 10 deletions
@@ -1,5 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -37,7 +36,7 @@ fun box(): String {
try {
Test2::class.java.getDeclaredField("\$\$delegate_0")
return "\$\$delegate_0 field generated for class Test but should not"
return "\$\$delegate_0 field generated for class Test2 but should not"
}
catch (e: NoSuchFieldException) {
// ok