Files
kotlin-fork/compiler/testData/codegen/box/inference/builderInference/kt44241.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

23 lines
441 B
Kotlin
Vendored

// !LANGUAGE: +UnrestrictedBuilderInference
// WITH_STDLIB
import kotlin.experimental.ExperimentalTypeInference
class A
class B<K> {}
class Scope<K11, K22>(
val key: K11,
) {
fun emit(key: K22) {}
}
@OptIn(ExperimentalTypeInference::class)
fun <K1, K2> B<K1>.scoped(@kotlin.BuilderInference binder: Scope<K1, K2>.() -> Unit) {}
fun run(x: B<A>) {
x.scoped { emit(key) }
}
fun box(): String {
run(B<A>())
return "OK"
}