diff --git a/compiler/testData/codegen/box/defaultArguments/implementedByFake.kt b/compiler/testData/codegen/box/defaultArguments/implementedByFake.kt index 3b72687973c..2dabfb4d267 100644 --- a/compiler/testData/codegen/box/defaultArguments/implementedByFake.kt +++ b/compiler/testData/codegen/box/defaultArguments/implementedByFake.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JVM interface I { diff --git a/compiler/testData/codegen/box/defaultArguments/implementedByFake2.kt b/compiler/testData/codegen/box/defaultArguments/implementedByFake2.kt index b6d31a9df89..cd511964c31 100644 --- a/compiler/testData/codegen/box/defaultArguments/implementedByFake2.kt +++ b/compiler/testData/codegen/box/defaultArguments/implementedByFake2.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JVM interface I { diff --git a/compiler/testData/codegen/box/defaultArguments/implementedByFake3.kt b/compiler/testData/codegen/box/defaultArguments/implementedByFake3.kt index d27ef2ac810..39dfc4eca33 100644 --- a/compiler/testData/codegen/box/defaultArguments/implementedByFake3.kt +++ b/compiler/testData/codegen/box/defaultArguments/implementedByFake3.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JVM interface I { diff --git a/compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt b/compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt new file mode 100644 index 00000000000..480152763e1 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt @@ -0,0 +1,20 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR + +inline class IC(val x: String) + +interface I { + fun foo(): T +} + +interface II: I + +class A : I { + override fun foo() = IC("O") +} + +class B : II { + override fun foo() = IC("K") +} + +fun box() = A().foo().x + B().foo().x diff --git a/compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt b/compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt new file mode 100644 index 00000000000..6554d74537c --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR + +inline class IC(val x: Int) + +interface I { + fun foo(t: T): T +} + +interface I2: I + +open class A { + fun foo(t: T): T = + if (t is IC) + IC(20 + t.x) as T + else + t +} + +open class B: A() +class C: I2, B() + +fun box(): String { + val ic = IC(10) + val i: I = C() + val i2: I2 = C() + val a: A = C() + val b: B = C() + val c: C = C() + + val fooI = i.foo(ic).x + if (fooI != 30) return "Fail I" + + // Test calling abstract fake override methods + // with signature specialized by inline class + val fooI2 = i2.foo(ic).x + if (fooI2 != 30) return "Fail I2" + + val fooA = a.foo(ic).x + if (fooA != 30) return "Fail A" + + val fooB = b.foo(ic).x + if (fooB != 30) return "Fail B" + + val resC = c.foo(ic).x + if (resC != 30) return "Fail C" + + return "OK" +} diff --git a/compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt b/compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt new file mode 100644 index 00000000000..b7cca19cf76 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt @@ -0,0 +1,33 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR + +inline class IC(val x: Int) + +abstract class A { + var t: T? = null + final fun foo(): T = t!! +} + +class B: A() + +interface I { + fun foo(): IC +} + +class B2: A(), I + + +fun box(): String { + val b = B() + b.t = IC(10) + if (b.foo() != IC(10)) return "Fail 1" + + val b2 = B2() + b2.t = IC(10) + if (b2.foo() != IC(10)) return "Fail 2" + + val b2i: I = b2 + if (b2i.foo() != IC(10)) return "Fail 3" + + return "OK" +} diff --git a/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceExtensionFunCall.kt b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceExtensionFunCall.kt index a3820aad7db..c5937547f12 100644 --- a/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceExtensionFunCall.kt +++ b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceExtensionFunCall.kt @@ -1,5 +1,5 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND: JVM_IR, JS_IR +// IGNORE_BACKEND: JVM_IR interface IFoo> { fun T.foo(): String = bar() diff --git a/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt index f89669fb38b..c210b31e867 100644 --- a/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt +++ b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt @@ -1,5 +1,5 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND: JVM_IR, JS_IR +// IGNORE_BACKEND: JVM_IR interface IFoo> { fun foo(t: T): String = t.bar() diff --git a/compiler/testData/codegen/box/inlineClasses/kt27132.kt b/compiler/testData/codegen/box/inlineClasses/kt27132.kt index 6b0dde3545c..d41f580cae0 100644 --- a/compiler/testData/codegen/box/inlineClasses/kt27132.kt +++ b/compiler/testData/codegen/box/inlineClasses/kt27132.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +InlineClasses // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME inline class Ucn(private val i: UInt) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 641207cb83e..b9dd1c3e7ac 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -11803,6 +11803,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxOfInlineClassForCapturedVars.kt"); } + @TestMetadata("bridgeForFunctionReturningInlineClass.kt") + public void testBridgeForFunctionReturningInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt"); + } + @TestMetadata("bridgeGenerationWithInlineClassOverAny.kt") public void testBridgeGenerationWithInlineClassOverAny() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt"); @@ -11848,6 +11853,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingAfterAssertionOperator.kt"); } + @TestMetadata("checkBoxingForComplexClassHierarchy.kt") + public void testCheckBoxingForComplexClassHierarchy() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt"); + } + @TestMetadata("checkBoxingForNonLocalAndLabeledReturns.kt") public void testCheckBoxingForNonLocalAndLabeledReturns() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForNonLocalAndLabeledReturns.kt"); @@ -11868,6 +11878,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingOnLocalVariableAssignments.kt"); } + @TestMetadata("checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt") + public void testCheckBoxingUnboxingForInheritedTypeSpecializedFunctions() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt"); + } + @TestMetadata("checkCallingMembersInsideInlineClass.kt") public void testCheckCallingMembersInsideInlineClass() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/checkCallingMembersInsideInlineClass.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 560b557b3d1..dafe58465c3 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -11808,6 +11808,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxOfInlineClassForCapturedVars.kt"); } + @TestMetadata("bridgeForFunctionReturningInlineClass.kt") + public void testBridgeForFunctionReturningInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt"); + } + @TestMetadata("bridgeGenerationWithInlineClassOverAny.kt") public void testBridgeGenerationWithInlineClassOverAny() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt"); @@ -11853,6 +11858,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingAfterAssertionOperator.kt"); } + @TestMetadata("checkBoxingForComplexClassHierarchy.kt") + public void testCheckBoxingForComplexClassHierarchy() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt"); + } + @TestMetadata("checkBoxingForNonLocalAndLabeledReturns.kt") public void testCheckBoxingForNonLocalAndLabeledReturns() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForNonLocalAndLabeledReturns.kt"); @@ -11873,6 +11883,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingOnLocalVariableAssignments.kt"); } + @TestMetadata("checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt") + public void testCheckBoxingUnboxingForInheritedTypeSpecializedFunctions() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt"); + } + @TestMetadata("checkCallingMembersInsideInlineClass.kt") public void testCheckCallingMembersInsideInlineClass() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/checkCallingMembersInsideInlineClass.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java index 98532b84fd7..eebcedaef57 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java @@ -9453,6 +9453,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxOfInlineClassForCapturedVars.kt"); } + @TestMetadata("bridgeForFunctionReturningInlineClass.kt") + public void testBridgeForFunctionReturningInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt"); + } + @TestMetadata("bridgeGenerationWithInlineClassOverAny.kt") public void testBridgeGenerationWithInlineClassOverAny() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt"); @@ -9488,6 +9493,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingAfterAssertionOperator.kt"); } + @TestMetadata("checkBoxingForComplexClassHierarchy.kt") + public void testCheckBoxingForComplexClassHierarchy() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt"); + } + @TestMetadata("checkBoxingForNonLocalAndLabeledReturns.kt") public void testCheckBoxingForNonLocalAndLabeledReturns() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForNonLocalAndLabeledReturns.kt"); @@ -9508,6 +9518,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingOnLocalVariableAssignments.kt"); } + @TestMetadata("checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt") + public void testCheckBoxingUnboxingForInheritedTypeSpecializedFunctions() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt"); + } + @TestMetadata("checkCallingMembersInsideInlineClass.kt") public void testCheckCallingMembersInsideInlineClass() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/checkCallingMembersInsideInlineClass.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 2816c2b8d80..73dd72e1de6 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -10503,6 +10503,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxOfInlineClassForCapturedVars.kt"); } + @TestMetadata("bridgeForFunctionReturningInlineClass.kt") + public void testBridgeForFunctionReturningInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt"); + } + @TestMetadata("bridgeGenerationWithInlineClassOverAny.kt") public void testBridgeGenerationWithInlineClassOverAny() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt"); @@ -10538,6 +10543,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingAfterAssertionOperator.kt"); } + @TestMetadata("checkBoxingForComplexClassHierarchy.kt") + public void testCheckBoxingForComplexClassHierarchy() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt"); + } + @TestMetadata("checkBoxingForNonLocalAndLabeledReturns.kt") public void testCheckBoxingForNonLocalAndLabeledReturns() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForNonLocalAndLabeledReturns.kt"); @@ -10558,6 +10568,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingOnLocalVariableAssignments.kt"); } + @TestMetadata("checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt") + public void testCheckBoxingUnboxingForInheritedTypeSpecializedFunctions() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt"); + } + @TestMetadata("checkCallingMembersInsideInlineClass.kt") public void testCheckCallingMembersInsideInlineClass() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/checkCallingMembersInsideInlineClass.kt"); diff --git a/js/js.translator/testData/box/native/overrideNativeOverloadedFunction.kt b/js/js.translator/testData/box/native/overrideNativeOverloadedFunction.kt index 5b643822b25..3221b24603c 100644 --- a/js/js.translator/testData/box/native/overrideNativeOverloadedFunction.kt +++ b/js/js.translator/testData/box/native/overrideNativeOverloadedFunction.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1304 external open class A { open fun f(x: Int): String = definedExternally