FIR: Add more tests for delegate inference

This commit is contained in:
Simon Ogorodnik
2021-11-14 16:19:06 +03:00
committed by teamcity
parent bb411cbba7
commit 2e69f7732c
8 changed files with 143 additions and 0 deletions
@@ -0,0 +1,16 @@
import kotlin.reflect.KProperty
class Delegate<T>(val data: T) {
operator fun getValue(thisRef: Nothing?, prop: KProperty<*>): T = data
}
fun makeIntDelegate(t: Int): Delegate<Int> = Delegate(t)
fun <TT> makeDelegate(t: TT): Delegate<TT> = Delegate(t)
fun <M> materialize(): M = null!!
fun <M2> materialize2(): M2 = null!!
fun <Q> id(v: Q): Q = v
val x by makeIntDelegate(run {
val x: String = materialize()
materialize2()
})