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