Remove constraints containing stub types after completion of the common system of a builder inference call

^KT-49285 Fixed
This commit is contained in:
Victor Petukhov
2021-10-19 14:07:54 +03:00
parent 012f1f6013
commit 64c682f465
14 changed files with 89 additions and 0 deletions
@@ -0,0 +1,25 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
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"
}