[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
This commit is contained in:
committed by
Space Team
parent
64f90f685d
commit
291d52820c
@@ -0,0 +1,15 @@
|
||||
// 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"
|
||||
}
|
||||
Reference in New Issue
Block a user