NI: do substitution type variables during updating trace for lambda (these type variables can appear after the builder inference)

^KT-42450 Fixed
This commit is contained in:
Victor Petukhov
2020-10-12 16:21:07 +03:00
parent e399b4cd12
commit 0685beb765
8 changed files with 56 additions and 9 deletions
@@ -0,0 +1,25 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
class Foo<A>
fun <K> bar(x: Foo<K>): Unit {}
fun <E> foo(block: (Foo<E>) -> Unit): E = null as E
interface FlowCollector<T> {
fun emit(value: T)
}
@Suppress("EXPERIMENTAL_API_USAGE_ERROR")
fun <I> flow(@BuilderInference block: FlowCollector<I>.() -> Unit): I = null as I
fun adapt(): Unit = flow {
emit(foo { coroutine -> bar(coroutine) })
}
fun box(): String {
adapt()
return "OK"
}