NI: exclude not fixed type variables from types on which null checks should be generated

^KT-36371 Fixed
This commit is contained in:
Victor Petukhov
2020-02-18 16:02:44 +03:00
parent f10696da5e
commit e8524137c3
8 changed files with 140 additions and 1 deletions
@@ -0,0 +1,31 @@
// !LANGUAGE: +NewInference
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
// 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"
}