Add another test for KT-49715 and fix JS IR behavior

#KT-49715
 #KT-51798 Fixed
This commit is contained in:
Alexander Udalov
2022-04-01 22:46:13 +02:00
committed by Alexander Udalov
parent 24105139ea
commit df86290083
10 changed files with 67 additions and 2 deletions
@@ -13143,6 +13143,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/dataClasses/kt49715.kt");
}
@Test
@TestMetadata("kt49715_behaviorChange.kt")
public void testKt49715_behaviorChange() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/kt49715_behaviorChange.kt");
}
@Test
@TestMetadata("kt5002.kt")
public void testKt5002() throws Exception {
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.ir.types.isNullableAny
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
import org.jetbrains.kotlin.ir.util.isTopLevelDeclaration
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.util.OperatorNameConventions
fun TODO(element: IrElement): Nothing = TODO(element::class.java.simpleName + " is not supported yet here")
@@ -58,9 +59,10 @@ fun IrFunction.hasStableJsName(context: JsIrBackendContext): Boolean {
return (isEffectivelyExternal() || getJsName() != null || isExported(context)) && namedOrMissingGetter
}
fun IrFunction.isEqualsInheritedFromAny() =
name == Name.identifier("equals") &&
fun IrFunction.isEqualsInheritedFromAny(): Boolean =
name == OperatorNameConventions.EQUALS &&
dispatchReceiverParameter != null &&
extensionReceiverParameter == null &&
valueParameters.size == 1 &&
valueParameters[0].type.isNullableAny()
@@ -0,0 +1,17 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FIR status: [IR VALIDATION] Duplicate IR node: FUN GENERATED_DATA_CLASS_MEMBER name:equals
interface A {
fun Any.equals(other: Any?): Boolean = false
fun Any.hashCode(): Int = 0
fun Any.toString(): String = ""
}
data class B(val x: Int) : A
fun box(): String {
if (B(42) != B(42)) return "Fail equals"
if (B(42).hashCode() != B(42).hashCode()) return "Fail hashCode"
if (B(42).toString() != B(42).toString()) return "Fail toString"
return "OK"
}
@@ -13017,6 +13017,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/dataClasses/kt49715.kt");
}
@Test
@TestMetadata("kt49715_behaviorChange.kt")
public void testKt49715_behaviorChange() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/kt49715_behaviorChange.kt");
}
@Test
@TestMetadata("kt5002.kt")
public void testKt5002() throws Exception {
@@ -13143,6 +13143,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/dataClasses/kt49715.kt");
}
@Test
@TestMetadata("kt49715_behaviorChange.kt")
public void testKt49715_behaviorChange() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/kt49715_behaviorChange.kt");
}
@Test
@TestMetadata("kt5002.kt")
public void testKt5002() throws Exception {
@@ -10542,6 +10542,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/dataClasses/kt49715.kt");
}
@TestMetadata("kt49715_behaviorChange.kt")
public void testKt49715_behaviorChange() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/kt49715_behaviorChange.kt");
}
@TestMetadata("kt5002.kt")
public void testKt5002() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/kt5002.kt");
@@ -9731,6 +9731,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/dataClasses/kt49715.kt");
}
@Test
@TestMetadata("kt49715_behaviorChange.kt")
public void testKt49715_behaviorChange() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/kt49715_behaviorChange.kt");
}
@Test
@TestMetadata("mixedParams.kt")
public void testMixedParams() throws Exception {
@@ -9773,6 +9773,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/dataClasses/kt49715.kt");
}
@Test
@TestMetadata("kt49715_behaviorChange.kt")
public void testKt49715_behaviorChange() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/kt49715_behaviorChange.kt");
}
@Test
@TestMetadata("mixedParams.kt")
public void testMixedParams() throws Exception {
@@ -8554,6 +8554,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/dataClasses/kt49715.kt");
}
@TestMetadata("kt49715_behaviorChange.kt")
public void testKt49715_behaviorChange() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/kt49715_behaviorChange.kt");
}
@TestMetadata("mixedParams.kt")
public void testMixedParams() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/mixedParams.kt");
@@ -10687,6 +10687,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/dataClasses/kt49715.kt");
}
@Test
@TestMetadata("kt49715_behaviorChange.kt")
public void testKt49715_behaviorChange() throws Exception {
runTest("compiler/testData/codegen/box/dataClasses/kt49715_behaviorChange.kt");
}
@Test
@TestMetadata("mixedParams.kt")
public void testMixedParams() throws Exception {