mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 08:31:29 +00:00
Two changes here: StackValue.Constant does cast iff value is non-null (if null, no cast between classes is really needed, as null can be an instance of anything), and codegen for safe qualified expressions uses correct type for the expression #KT-4265 Fixed
21 lines
421 B
Kotlin
21 lines
421 B
Kotlin
fun isNull(x: Unit?) = x == null
|
|
|
|
fun isNullGeneric<T : Any>(x: T?) = x == null
|
|
|
|
fun deepIsNull0(x: Unit?) = isNull(x)
|
|
fun deepIsNull(x: Unit?) = deepIsNull0(x)
|
|
|
|
fun box(): String {
|
|
if (!isNull(null)) return "Fail 1"
|
|
|
|
val x: Unit? = null
|
|
if (!isNull(x)) return "Fail 2"
|
|
|
|
val y = x
|
|
if (!isNullGeneric(y)) return "Fail 3"
|
|
|
|
if (!deepIsNull((null : Unit?) ?: null)) return "Fail 4"
|
|
|
|
return "OK"
|
|
}
|