Files
kotlin/compiler/testData/codegen/box/inlineClasses/inlineClassWithCustomEquals.kt
Dmitry Petrov 4f6aa50417 Fix == for inline classes with boxes
TODO generalize code generating object vs primitive equality

 #KT-25914 Fixed
 #KT-25981 Fixed
 #KT-25983 Fixed
2018-08-10 10:34:57 +03:00

14 lines
293 B
Kotlin
Vendored

// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Z(val data: Int) {
override fun equals(other: Any?): Boolean =
other is Z &&
data % 256 == other.data % 256
}
fun box(): String {
if (Z(0) != Z(256)) throw AssertionError()
return "OK"
}