Files
kotlin/compiler/testData/codegen/box/nullCheckOptimization/kt22410.kt
2018-06-28 12:26:41 +02:00

22 lines
368 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
fun box(): String {
defineFunc<String>()
func(1)
return if (testedEquals) "OK" else "Fail"
}
var func: (Any) -> Unit = {}
var testedEquals = false
inline fun <reified T> defineFunc() {
func = {
val nullable = it as? T
if (nullable == null)
testedEquals = true
}
}