diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java index 48247834fa3..874716e577a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java @@ -31,6 +31,7 @@ import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader; import org.jetbrains.kotlin.metadata.ProtoBuf; import org.jetbrains.kotlin.psi.KtElement; import org.jetbrains.kotlin.resolve.DescriptorUtils; +import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt; import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt; @@ -367,6 +368,11 @@ public class ClosureCodegen extends MemberCodegen { value = StackValue.local(slot, type, bridgeParameterKotlinTypes.get(i)); slot += type.getSize(); } + if (InlineClassesCodegenUtilKt.isInlineClassWithUnderlyingTypeAnyOrAnyN(parameterType) && + functionReferenceCall == null + ) { + parameterType = InlineClassesUtilsKt.unsubstitutedUnderlyingParameter(parameterType).getType(); + } value.put(typeMapper.mapType(calleeParameter), parameterType, iv); } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index b9ffc34b607..92fc055765a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -1995,6 +1995,21 @@ public class ExpressionCodegen extends KtVisitor impleme StackValue localOrCaptured = findLocalOrCapturedValue(descriptor); if (localOrCaptured != null) { + if (descriptor instanceof ValueParameterDescriptor) { + KotlinType inlineClassType = ((ValueParameterDescriptor) descriptor).getType(); + if (InlineClassesCodegenUtilKt.isInlineClassWithUnderlyingTypeAnyOrAnyN(inlineClassType) && + InlineClassesCodegenUtilKt.isGenericParameter((CallableDescriptor) descriptor) && + // TODO: HACK around bridgeGenerationCrossinline + !(context instanceof InlineLambdaContext) && + // Do not unbox parameters of suspend lambda, they are unboxed in `invoke` method + !CoroutineCodegenUtilKt.isInvokeSuspendOfLambda(context.getFunctionDescriptor()) + ) { + KotlinType underlyingType = InlineClassesUtilsKt.underlyingRepresentation( + (ClassDescriptor) inlineClassType.getConstructor().getDeclarationDescriptor()).getType(); + return StackValue.underlyingValueOfInlineClass( + typeMapper.mapType(underlyingType), underlyingType, localOrCaptured); + } + } return localOrCaptured; } throw new UnsupportedOperationException("don't know how to generate reference " + descriptor); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt new file mode 100644 index 00000000000..cb76c239864 --- /dev/null +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt @@ -0,0 +1,29 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen + +import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor +import org.jetbrains.kotlin.resolve.isInlineClassType +import org.jetbrains.kotlin.resolve.underlyingRepresentation +import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.typeUtil.isAnyOrNullableAny +import org.jetbrains.kotlin.types.typeUtil.isTypeParameter + +fun KotlinType.isInlineClassWithUnderlyingTypeAnyOrAnyN(): Boolean { + if (!isInlineClassType()) return false + val classDescriptor = constructor.declarationDescriptor as? ClassDescriptor ?: return false + return classDescriptor.underlyingRepresentation()?.type?.isAnyOrNullableAny() == true +} + +fun CallableDescriptor.isGenericParameter(): Boolean { + if (this !is ValueParameterDescriptor) return false + if (containingDeclaration is AnonymousFunctionDescriptor) return true + val index = containingDeclaration.valueParameters.indexOf(this) + return containingDeclaration.overriddenDescriptors.any { it.original.valueParameters[index].type.isTypeParameter() } +} \ No newline at end of file diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index fedb14a38b5..4038fbeb5c4 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -15081,6 +15081,163 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java index 2e5fc9358b8..308a59f154c 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java @@ -1950,6 +1950,148 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractFirBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractFirBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractFirBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractFirBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses") diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt new file mode 100644 index 00000000000..555df6d08ae --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + it.value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +inline class IC(val value: Any) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC(40)) + 2 + if (res != 42) return "FAIL 1: $res" + + res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt new file mode 100644 index 00000000000..a13cbf30be8 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + it.value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +inline class IC(val value: Any?) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC(40)) + 2 + if (res != 42) "FAIL 1 $res" + + res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt new file mode 100644 index 00000000000..97146b302bf --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt @@ -0,0 +1,53 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + (it.value as FooHolder).value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun IC.extensionValue(): T = (value as FooHolder).value as T + +fun normalValue(ic: IC): T = (ic.value as FooHolder).value as T + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: Foo): Foo { + fun dispatchValue(): T = (value as FooHolder).value as T +} + +fun box(): String { + var res = underlying(IC(FooHolder(40))) + 2 + if (res != 42) return "FAIL 1: $res" + + res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt new file mode 100644 index 00000000000..a2368761b61 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt @@ -0,0 +1,53 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + (it.value as FooHolder).value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun IC.extensionValue(): T = (value as FooHolder).value as T + +fun normalValue(ic: IC): T = (ic.value as FooHolder).value as T + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: FooHolder): Foo { + fun dispatchValue(): T = (value as FooHolder).value as T +} + +fun box(): String { + var res = underlying(IC(FooHolder(40))) + 2 + if (res != 42) return "FAIL 1: $res" + + res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt new file mode 100644 index 00000000000..64605198b73 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + it.value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +inline class IC(val value: Int) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC(40)) + 2 + if (res != 42) "FAIL 1: $res" + + res = extension(IC(40)) + 3 + if (res != 43) "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt new file mode 100644 index 00000000000..aace7ed01cc --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt @@ -0,0 +1,21 @@ +// !LANGUAGE: +InlineClasses +// WITH_RUNTIME +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR + +fun foo(a: Result): T = bar(a) { + it.getOrThrow() +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun box(): String { + val res = foo(Result.success(40)) + 2 + return if (res != 42) "FAIL $res" else "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt new file mode 100644 index 00000000000..fda16c3a330 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR + +fun underlying(a: IC): T = bar(a) { + it.value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +inline class IC(val value: String) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC("O")) + "K" + if (res != "OK") return "FAIL 1: $res" + + res = extension(IC("O")) + "K" + if (res != "OK") return "FAIL 2: $res" + + res = dispatch(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + res = normal(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt new file mode 100644 index 00000000000..5aaa8f9e26c --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt @@ -0,0 +1,45 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + it.value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +inline class IC(val value: Any) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC(40)) + 2 + if (res != 42) return "FAIL 1: $res" + + res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt new file mode 100644 index 00000000000..785383cd6b9 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt @@ -0,0 +1,45 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + it.value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +inline class IC(val value: Any?) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC(40)) + 2 + if (res != 42) "FAIL 1 $res" + + res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt new file mode 100644 index 00000000000..86920af319e --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + (it.value as FooHolder).value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun IC.extensionValue(): T = (value as FooHolder).value as T + +fun normalValue(ic: IC): T = (ic.value as FooHolder).value as T + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: Foo): Foo { + fun dispatchValue(): T = (value as FooHolder).value as T +} + +fun box(): String { + var res = underlying(IC(FooHolder(40))) + 2 + if (res != 42) return "FAIL 1: $res" + + res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt new file mode 100644 index 00000000000..33e9a41beb3 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + (it.value as FooHolder).value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun IC.extensionValue(): T = (value as FooHolder).value as T + +fun normalValue(ic: IC): T = (ic.value as FooHolder).value as T + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: FooHolder): Foo { + fun dispatchValue(): T = (value as FooHolder).value as T +} + +fun box(): String { + var res = underlying(IC(FooHolder(40))) + 2 + if (res != 42) return "FAIL 1: $res" + + res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt new file mode 100644 index 00000000000..40faf36197b --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt @@ -0,0 +1,45 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a) { + it.value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +inline class IC(val value: Int) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC(40)) + 2 + if (res != 42) "FAIL 1: $res" + + res = extension(IC(40)) + 3 + if (res != 43) "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt new file mode 100644 index 00000000000..ea0c0dff3fd --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt @@ -0,0 +1,17 @@ +// !LANGUAGE: +InlineClasses +// WITH_RUNTIME +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR + +fun foo(a: Result): T = bar(a) { + it.getOrThrow() +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun box(): String { + val res = foo(Result.success(40)) + 2 + return if (res != 42) "FAIL $res" else "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt new file mode 100644 index 00000000000..c8ec62c787c --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR + +fun underlying(a: IC): T = bar(a) { + it.value as T +} + +fun extension(a: IC): T = bar(a) { + it.extensionValue() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchValue() +} + +fun normal(a: IC): T = bar(a) { + normalValue(it) +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +inline class IC(val value: String) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC("O")) + "K" + if (res != "OK") return "FAIL 1: $res" + + res = extension(IC("O")) + "K" + if (res != "OK") return "FAIL 2: $res" + + res = dispatch(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + res = normal(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt new file mode 100644 index 00000000000..56220dcecba --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.value as T +}) + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.extensionValue() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.dispatchValue() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = normalValue(ic) +}) + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +inline class IC(val value: Any) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC(40)) + 2 + if (res != 42) return "FAIL 1: $res" + + res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt new file mode 100644 index 00000000000..ab7e77f8e9b --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.value as T +}) + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.extensionValue() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.dispatchValue() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = normalValue(ic) +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +inline class IC(val value: Any?) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC(40)) + 2 + if (res != 42) "FAIL 1 $res" + + res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt new file mode 100644 index 00000000000..f537e499007 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt @@ -0,0 +1,53 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = (ic.value as FooHolder).value as T +}) + +//fun extension(a: IC): T = bar(a, object : IFace { +// override fun call(ic: IC): T = ic.extensionValue() +//}) +// +//fun dispatch(a: IC): T = bar(a, object : IFace { +// override fun call(ic: IC): T = ic.dispatchValue() +//}) +// +//fun normal(a: IC): T = bar(a, object : IFace { +// override fun call(ic: IC): T = normalValue(ic) +//}) +// +//fun IC.extensionValue(): T = (value as FooHolder).value as T +// +//fun normalValue(ic: IC): T = (ic.value as FooHolder).value as T + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: Foo): Foo { +// fun dispatchValue(): T = (value as FooHolder).value as T +} + +fun box(): String { + var res = underlying(IC(FooHolder(40))) + 2 + if (res != 42) return "FAIL 1: $res" + +// res = extension(IC(FooHolder(40))) + 3 +// if (res != 43) return "FAIL 2: $res" +// +// res = dispatch(IC(FooHolder(40))) + 4 +// if (res != 44) return "FAIL 3: $res" +// +// res = normal(IC(FooHolder(40))) + 5 +// if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt new file mode 100644 index 00000000000..11f4c1bb07f --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt @@ -0,0 +1,53 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = (ic.value as FooHolder).value as T +}) + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.extensionValue() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.dispatchValue() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = normalValue(ic) +}) + +fun IC.extensionValue(): T = (value as FooHolder).value as T + +fun normalValue(ic: IC): T = (ic.value as FooHolder).value as T + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: FooHolder): Foo { + fun dispatchValue(): T = (value as FooHolder).value as T +} + +fun box(): String { + var res = underlying(IC(FooHolder(40))) + 2 + if (res != 42) return "FAIL 1: $res" + + res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt new file mode 100644 index 00000000000..c6f7ec60ff7 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +InlineClasses + +fun underlying(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.value as T +}) + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.extensionValue() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.dispatchValue() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = normalValue(ic) +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +inline class IC(val value: Int) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC(40)) + 2 + if (res != 42) "FAIL 1: $res" + + res = extension(IC(40)) + 3 + if (res != 43) "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt new file mode 100644 index 00000000000..9a0d8e7d0f9 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt @@ -0,0 +1,21 @@ +// !LANGUAGE: +InlineClasses +// WITH_RUNTIME +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR + +fun foo(a: Result): T = bar(a, object : IFace, T> { + override fun call(ic: Result): T = ic.getOrThrow() +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun box(): String { + val res = foo(Result.success(40)) + 2 + return if (res != 42) "FAIL $res" else "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt new file mode 100644 index 00000000000..a44ea4108e5 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR + +fun underlying(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.value as T +}) + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.extensionValue() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = ic.dispatchValue() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(ic: IC): T = normalValue(ic) +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun IC.extensionValue(): T = value as T + +fun normalValue(ic: IC): T = ic.value as T + +inline class IC(val value: String) { + fun dispatchValue(): T = value as T +} + +fun box(): String { + var res = underlying(IC("O")) + "K" + if (res != "OK") return "FAIL 1: $res" + + res = extension(IC("O")) + "K" + if (res != "OK") return "FAIL 2: $res" + + res = dispatch(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + res = normal(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt new file mode 100644 index 00000000000..7658fec1fb2 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +inline class IC(val value: Any) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt new file mode 100644 index 00000000000..7080acab31c --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +inline class IC(val value: Any?) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt new file mode 100644 index 00000000000..abf2462a71f --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: Foo): Foo { + inline fun dispatchInline(): T = (value as FooHolder).value as T +} + +inline fun IC.extensionInline(): T = (value as FooHolder).value as T + +inline fun normalInline(a: IC): T = (a.value as FooHolder).value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt new file mode 100644 index 00000000000..8b0829224b3 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: FooHolder): Foo { + inline fun dispatchInline(): T = (value as FooHolder).value as T +} + +inline fun IC.extensionInline(): T = (value as FooHolder).value as T + +inline fun normalInline(a: IC): T = (a.value as FooHolder).value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt new file mode 100644 index 00000000000..9841750ba54 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +inline class IC(val value: Int) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt new file mode 100644 index 00000000000..cbe2a024d65 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt @@ -0,0 +1,50 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR +// IGNORE_BACKEND_MULTI_MODULE: JVM_IR, JVM_MULTI_MODULE_IR_AGAINST_OLD + +// FILE: inline.kt + +inline class IC(val value: String) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC("O")) + "K" + if (res != "OK") return "FAIL 2: $res" + + res = dispatch(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + res = normal(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt new file mode 100644 index 00000000000..3ed119240ab --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt @@ -0,0 +1,43 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +inline class IC(val value: Any) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun box(): String { + var res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt new file mode 100644 index 00000000000..ae83caa6fa4 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt @@ -0,0 +1,43 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +inline class IC(val value: Any?) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun box(): String { + var res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt new file mode 100644 index 00000000000..016b8d8434d --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: Foo): Foo { + inline fun dispatchInline(): T = (value as FooHolder).value as T +} + +inline fun IC.extensionInline(): T = (value as FooHolder).value as T + +inline fun normalInline(a: IC): T = (a.value as FooHolder).value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun box(): String { + var res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt new file mode 100644 index 00000000000..f718726117f --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: FooHolder): Foo { + inline fun dispatchInline(): T = (value as FooHolder).value as T +} + +inline fun IC.extensionInline(): T = (value as FooHolder).value as T + +inline fun normalInline(a: IC): T = (a.value as FooHolder).value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun box(): String { + var res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt new file mode 100644 index 00000000000..d3a9e4085e6 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt @@ -0,0 +1,43 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +inline class IC(val value: Int) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun box(): String { + var res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt new file mode 100644 index 00000000000..3c5cf7bed69 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt @@ -0,0 +1,46 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR +// IGNORE_BACKEND_MULTI_MODULE: JVM_IR, JVM_MULTI_MODULE_IR_AGAINST_OLD + +// FILE: inline.kt + +inline class IC(val value: String) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a) { + it.extensionInline() +} + +fun dispatch(a: IC): T = bar(a) { + it.dispatchInline() +} + +fun normal(a: IC): T = bar(a) { + normalInline(it) +} + +fun bar(value: T, f: (T) -> R): R { + return f(value) +} + +fun box(): String { + var res = extension(IC("O")) + "K" + if (res != "OK") return "FAIL 2: $res" + + res = dispatch(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + res = normal(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt new file mode 100644 index 00000000000..069c28fa678 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +inline class IC(val value: Any) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.extensionInline() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.dispatchInline() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = normalInline(it) +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt new file mode 100644 index 00000000000..6e47f095e6c --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +inline class IC(val value: Any?) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.extensionInline() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.dispatchInline() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = normalInline(it) +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt new file mode 100644 index 00000000000..b7a307b2761 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: Foo): Foo { + inline fun dispatchInline(): T = (value as FooHolder).value as T +} + +inline fun IC.extensionInline(): T = (value as FooHolder).value as T + +inline fun normalInline(a: IC): T = (a.value as FooHolder).value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.extensionInline() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.dispatchInline() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = normalInline(it) +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt new file mode 100644 index 00000000000..90d922c8bd4 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +interface Foo + +class FooHolder(val value: Any): Foo + +inline class IC(val value: FooHolder): Foo { + inline fun dispatchInline(): T = (value as FooHolder).value as T +} + +inline fun IC.extensionInline(): T = (value as FooHolder).value as T + +inline fun normalInline(a: IC): T = (a.value as FooHolder).value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.extensionInline() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.dispatchInline() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = normalInline(it) +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(FooHolder(40))) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(FooHolder(40))) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(FooHolder(40))) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt new file mode 100644 index 00000000000..3caa1af2e78 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +InlineClasses + +// FILE: inline.kt + +inline class IC(val value: Int) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.extensionInline() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.dispatchInline() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = normalInline(it) +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC(40)) + 3 + if (res != 43) return "FAIL 2: $res" + + res = dispatch(IC(40)) + 4 + if (res != 44) return "FAIL 3: $res" + + res = normal(IC(40)) + 5 + if (res != 45) return "FAIL 4: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt new file mode 100644 index 00000000000..f8293ece19c --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt @@ -0,0 +1,50 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR +// IGNORE_BACKEND_MULTI_MODULE: JVM_IR, JVM_MULTI_MODULE_IR_AGAINST_OLD + +// FILE: inline.kt + +inline class IC(val value: String) { + inline fun dispatchInline(): T = value as T +} + +inline fun IC.extensionInline(): T = value as T + +inline fun normalInline(a: IC): T = a.value as T + +// FILE: box.kt +// NO_CHECK_LAMBDA_INLINING + +fun extension(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.extensionInline() +}) + +fun dispatch(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = it.dispatchInline() +}) + +fun normal(a: IC): T = bar(a, object : IFace { + override fun call(it: IC): T = normalInline(it) +}) + +interface IFace { + fun call(ic: T): R +} + +fun bar(value: T, f: IFace): R { + return f.call(value) +} + +fun box(): String { + var res = extension(IC("O")) + "K" + if (res != "OK") return "FAIL 2: $res" + + res = dispatch(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + res = normal(IC("O")) + "K" + if (res != "OK") return "FAIL 3: $res" + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 46d78319300..8c27483ec16 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -16481,6 +16481,163 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java index 856307067b1..ab94c7a571a 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -1950,6 +1950,148 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index d4710ea473e..2155efe0562 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1950,6 +1950,148 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractCompileKotlinAgainstInlineKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractCompileKotlinAgainstInlineKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractCompileKotlinAgainstInlineKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractCompileKotlinAgainstInlineKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 0421c6cc124..78065a1b245 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -16481,6 +16481,163 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 4e6eea7934b..23a26d18b43 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -15081,6 +15081,163 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java index e5bbcf46719..5a6a62de7d2 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java @@ -1950,6 +1950,148 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractIrBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractIrBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractIrBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractIrBlackBoxInlineCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index 6b2ff92ca35..bc93b2fa427 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1950,6 +1950,148 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractIrCompileKotlinAgainstInlineKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractIrCompileKotlinAgainstInlineKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractIrCompileKotlinAgainstInlineKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractIrCompileKotlinAgainstInlineKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java index 9aa07e46432..e607d85e13a 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java @@ -1950,6 +1950,148 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractJvmIrAgainstOldBoxInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractJvmIrAgainstOldBoxInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractJvmIrAgainstOldBoxInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractJvmIrAgainstOldBoxInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java index 62f975aaa34..6d9b781d163 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java @@ -1950,6 +1950,148 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractJvmOldAgainstIrBoxInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractJvmOldAgainstIrBoxInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractJvmOldAgainstIrBoxInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractJvmOldAgainstIrBoxInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 46ac5cf82a3..aba203116e1 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -13061,6 +13061,163 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java index 0ba350578c9..7b09e3c6123 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java @@ -1740,6 +1740,148 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractIrJsCodegenInlineES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractIrJsCodegenInlineES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractIrJsCodegenInlineES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractIrJsCodegenInlineES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 642a7e73f3d..a9114f89e89 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -13061,6 +13061,163 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java index a666b0d1837..7960803a286 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java @@ -1740,6 +1740,148 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractIrJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractIrJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractIrJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractIrJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses") 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 573a1252cde..c947e3968e9 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 @@ -13126,6 +13126,163 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("result.kt") + public void testResult() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java index 957cac619b7..9d1de7d54f0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java @@ -1740,6 +1740,148 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { public void testWithReturnTypeManglingVal() throws Exception { runTest("compiler/testData/codegen/boxInline/inlineClasses/withReturnTypeManglingVal.kt"); } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnboxGenericParameter extends AbstractJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInUnboxGenericParameter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunInterface extends AbstractJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInFunInterface() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Lambda extends AbstractJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInLambda() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ObjectLiteral extends AbstractJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInObjectLiteral() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt"); + } + + @TestMetadata("anyN.kt") + public void testAnyN() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt"); + } + + @TestMetadata("iface.kt") + public void testIface() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt"); + } + + @TestMetadata("ifaceChild.kt") + public void testIfaceChild() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt"); + } + + @TestMetadata("primitive.kt") + public void testPrimitive() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt"); + } + + @TestMetadata("string.kt") + public void testString() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt"); + } + } + } } @TestMetadata("compiler/testData/codegen/boxInline/innerClasses")