Files
kotlin-fork/compiler/testData/diagnostics/tests/delegatedProperty/inference/tryInGenerated.kt
T
Mikhail Glukhikh 3964ee38be 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
2023-05-04 11:48:37 +00:00

17 lines
406 B
Kotlin
Vendored

// 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 {}
}