K2: fix handling of synthetic calls in delegate inference

This commit is intended to avoid the second resolve of delegate when
we need to consider provideDelegate() possibility in inference.
Also here we provide correct completion of synthetic calls during
delegate inference.

#KT-58013 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-04-28 09:21:36 +02:00
committed by Space Team
parent 8c8ca7bb70
commit 3964ee38be
19 changed files with 457 additions and 3 deletions
@@ -0,0 +1,16 @@
// FIR_IDENTICAL
// ISSUE: KT-58013 (related)
// WITH_REFLECT
// FIR_DUMP
import kotlin.reflect.KProperty
data class Ref<D>(val t: D)
operator fun <V> Ref<V>.getValue(hisRef: Any?, property: KProperty<*>): V = this.t
fun <E> List<Ref<*>>.getElement(i: Int): Ref<E> = this[i] <!UNCHECKED_CAST!>as Ref<E><!>
fun test(list: List<Ref<*>>) {
val data: String by try { list.getElement(0) } finally {}
}