[FE 1.0] Continue completion of calls inside that builder inference call postponed type variables of which has already been inferred

This commit is contained in:
Victor Petukhov
2022-05-07 22:44:52 +02:00
committed by teamcity
parent b8030ec1de
commit 7675361380
15 changed files with 64 additions and 50 deletions
@@ -1,24 +0,0 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WITH_STDLIB
import kotlin.experimental.ExperimentalTypeInference
class Foo<T> {
fun add(x: T) {}
}
@OptIn(ExperimentalTypeInference::class)
fun <K1> myBuilder1(@BuilderInference builder: Foo<K1>.() -> Foo<K1>): Foo<K1> = Foo<K1>().apply { builder() }
@OptIn(ExperimentalTypeInference::class)
fun <K2> myBuilder2(@BuilderInference builder: Foo<K2>.() -> Unit): Foo<K2> = Foo<K2>().apply(builder)
fun box(): String {
val result1 = myBuilder1 {
add(null)
myBuilder2 {
add("")
}
}
return "OK"
}