JS: prevent Any.equals from mangling
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
function foo(first, second) {
|
||||
return first.equals(second);
|
||||
}
|
||||
|
||||
function B(value) {
|
||||
this.value = value;
|
||||
}
|
||||
B.prototype.equals = function(other) {
|
||||
return other instanceof B && other.value == this.value;
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
data class A(val number: Int)
|
||||
|
||||
@native fun foo(first: A, second: A): Boolean
|
||||
|
||||
@native class B(value: Int)
|
||||
|
||||
fun box(): String {
|
||||
val a = A(23)
|
||||
val b = A(23)
|
||||
val c = A(42)
|
||||
|
||||
if (!foo(a, b)) return "fail1"
|
||||
if (!foo(a, a)) return "fail2"
|
||||
if (foo(a, c)) return "fail3"
|
||||
|
||||
val d = B(23)
|
||||
val e = B(23)
|
||||
val f = B(42)
|
||||
|
||||
if (d != e) return "fail4"
|
||||
if (d != d) return "fail5"
|
||||
if (d == f) return "fail6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user