Move tests for builder inference into the corresponding directory

This commit is contained in:
Victor Petukhov
2020-12-23 14:29:03 +03:00
parent 9b148325fe
commit 39e579db91
13 changed files with 43 additions and 0 deletions
@@ -0,0 +1,30 @@
// !LANGUAGE: +NewInference
// WITH_RUNTIME
// Issue: KT-36371
import kotlin.experimental.ExperimentalTypeInference
class Foo(val string: String? = null)
class Builder<T> {
private var resolver: ((Foo) -> T)? = null
fun build() = resolver!!
fun resolve(resolver: (Foo) -> T) {
this.resolver = resolver
}
}
@OptIn(ExperimentalTypeInference::class)
fun <T> build(@BuilderInference configure: Builder<T>.() -> Unit) =
Builder<T>().apply(configure).build()
fun box(): String {
val resolver = build {
resolve { it.string }
}
resolver(Foo())
return "OK"
}