Files
kotlin-fork/compiler/testData/codegen/box/reflection/callBy/kt60709.kt
T
Evgeniy.Zhelenskiy 291d52820c [Reflection] Use reference equality to determine that a callable reference is bound
It helps to avoid problems when receiver object implements structural equals violating the equality contract

#KT-60709
2023-10-05 22:16:39 +00:00

16 lines
313 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_REFLECT
class Eq {
override fun equals(other: Any?): Boolean = true
override fun toString(): String = "1"
val x: String get() = "2"
}
fun box(): String {
require(Eq()::toString.callBy(mapOf()) == "1")
require(Eq()::x.callBy(mapOf()) == "2")
return "OK"
}