JVM_IR JavaSamConversionEqualsHashCode

This commit is contained in:
Dmitry Petrov
2022-03-02 16:15:17 +03:00
committed by Space
parent 870cdfd226
commit fdb01d96f0
15 changed files with 204 additions and 7 deletions
@@ -0,0 +1,25 @@
// !LANGUAGE: +JavaSamConversionEqualsHashCode
// TARGET_BACKEND: JVM_IR
// FULL_JDK
class F(val v: String) : () -> Unit {
override fun invoke() {}
override fun equals(other: Any?): Boolean =
other is F && other.v == v
override fun hashCode(): Int =
v.hashCode()
}
fun box(): String {
val r1 = Runnable(F("abc"))
val r2 = Runnable(F("abc"))
if (r1 != r2)
return "r1 != r2"
if (r1.hashCode() != r2.hashCode())
return "r1.hashCode() != r2.hashCode()"
return "OK"
}