diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index fa9959a4270..ebe0aa4b8a2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -8105,6 +8105,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { doTest(fileName); } + @TestMetadata("intrinsic.kt") + public void testIntrinsic() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/superCall/intrinsic.kt"); + doTest(fileName); + } + @TestMetadata("nativeSuperClass.kt") public void testNativeSuperClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/superCall/nativeSuperClass.kt"); diff --git a/js/js.translator/testData/box/superCall/intrinsic.kt b/js/js.translator/testData/box/superCall/intrinsic.kt new file mode 100644 index 00000000000..4fc046a4139 --- /dev/null +++ b/js/js.translator/testData/box/superCall/intrinsic.kt @@ -0,0 +1,39 @@ +// EXPECTED_REACHABLE_NODES: 1141 +class A(val x: Int) { + override fun equals(other: Any?): Boolean = other is A && other.x == x + + override fun hashCode(): Int = x + + fun identityEquals(other: Any?) = super.equals(other) + + fun identityHashCode() = super.hashCode() +} + +data class B(val y: Int) { + fun identityEquals(other: Any?) = super.equals(other) + + fun identityHashCode() = super.hashCode() +} + +fun box(): String { + val a1 = A(23) + val a2 = A(23) + + if (a1 != a2) return "fail1" + if (a1.identityEquals(a2)) return "fail2" + if (!a1.identityEquals(a1)) return "fail3" + val ah: Any = a1.identityHashCode() + if (ah !is Int) return "fail4" + if (a1.hashCode() != 23) return "fail5" + + val b1 = B(23) + val b2 = B(23) + + if (b1 != b2) return "fail6" + if (b1.identityEquals(b2)) return "fail7" + if (!b1.identityEquals(b1)) return "fail8" + val bh: Any = a1.identityHashCode() + if (bh !is Int) return "fail9" + + return "OK" +} \ No newline at end of file