Files
kotlin/compiler/testData/codegen/box/inlineClasses/nullableEqeqNonNull.kt
2019-11-19 11:00:09 +03:00

20 lines
479 B
Kotlin
Vendored

// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
inline class Z(val value: Int)
fun eq(a: Z?, b: Z) = a == b
fun eqq(a: Z, b: Z?) = a == b
fun box(): String {
if (!eq(Z(1), Z(1))) throw AssertionError()
if (eq(Z(1), Z(2))) throw AssertionError()
if (eq(null, Z(0))) throw AssertionError()
if (!eqq(Z(1), Z(1))) throw AssertionError()
if (eqq(Z(1), Z(2))) throw AssertionError()
if (eqq(Z(0), null)) throw AssertionError()
return "OK"
}