From a775fa195bd9e973f284b2507b0690a2c7948ee5 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Tue, 20 Oct 2020 19:38:06 +0200 Subject: [PATCH] Unbox inline class parameter of lambda if underlying type is Any or Any? The inline class is boxed when we pass it as lambda argument, now we unbox it. If the underlying type is not Any or Any?, bridge method does the unboxing. #KT-32450 Fixed #KT-39923 Fixed #KT-32228 Fixed #KT-40282 Fixed --- .../kotlin/codegen/ClosureCodegen.java | 6 + .../kotlin/codegen/ExpressionCodegen.java | 15 ++ .../codegen/inlineClassesCodegenUtil.kt | 29 ++++ .../ir/FirBlackBoxCodegenTestGenerated.java | 157 ++++++++++++++++++ ...FirBlackBoxInlineCodegenTestGenerated.java | 142 ++++++++++++++++ .../unboxGenericParameter/funInterface/any.kt | 49 ++++++ .../funInterface/anyN.kt | 49 ++++++ .../funInterface/iface.kt | 53 ++++++ .../funInterface/ifaceChild.kt | 53 ++++++ .../funInterface/primitive.kt | 49 ++++++ .../funInterface/result.kt | 21 +++ .../funInterface/string.kt | 51 ++++++ .../unboxGenericParameter/lambda/any.kt | 45 +++++ .../unboxGenericParameter/lambda/anyN.kt | 45 +++++ .../unboxGenericParameter/lambda/iface.kt | 49 ++++++ .../lambda/ifaceChild.kt | 49 ++++++ .../unboxGenericParameter/lambda/primitive.kt | 45 +++++ .../unboxGenericParameter/lambda/result.kt | 17 ++ .../unboxGenericParameter/lambda/string.kt | 47 ++++++ .../objectLiteral/any.kt | 49 ++++++ .../objectLiteral/anyN.kt | 49 ++++++ .../objectLiteral/iface.kt | 53 ++++++ .../objectLiteral/ifaceChild.kt | 53 ++++++ .../objectLiteral/primitive.kt | 49 ++++++ .../objectLiteral/result.kt | 21 +++ .../objectLiteral/string.kt | 51 ++++++ .../unboxGenericParameter/funInterface/any.kt | 47 ++++++ .../funInterface/anyN.kt | 47 ++++++ .../funInterface/iface.kt | 51 ++++++ .../funInterface/ifaceChild.kt | 51 ++++++ .../funInterface/primitive.kt | 47 ++++++ .../funInterface/string.kt | 50 ++++++ .../unboxGenericParameter/lambda/any.kt | 43 +++++ .../unboxGenericParameter/lambda/anyN.kt | 43 +++++ .../unboxGenericParameter/lambda/iface.kt | 47 ++++++ .../lambda/ifaceChild.kt | 47 ++++++ .../unboxGenericParameter/lambda/primitive.kt | 43 +++++ .../unboxGenericParameter/lambda/string.kt | 46 +++++ .../objectLiteral/any.kt | 47 ++++++ .../objectLiteral/anyN.kt | 47 ++++++ .../objectLiteral/iface.kt | 51 ++++++ .../objectLiteral/ifaceChild.kt | 51 ++++++ .../objectLiteral/primitive.kt | 47 ++++++ .../objectLiteral/string.kt | 50 ++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 157 ++++++++++++++++++ .../BlackBoxInlineCodegenTestGenerated.java | 142 ++++++++++++++++ ...otlinAgainstInlineKotlinTestGenerated.java | 142 ++++++++++++++++ .../LightAnalysisModeTestGenerated.java | 157 ++++++++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 157 ++++++++++++++++++ .../IrBlackBoxInlineCodegenTestGenerated.java | 142 ++++++++++++++++ ...otlinAgainstInlineKotlinTestGenerated.java | 142 ++++++++++++++++ ...JvmIrAgainstOldBoxInlineTestGenerated.java | 142 ++++++++++++++++ ...JvmOldAgainstIrBoxInlineTestGenerated.java | 142 ++++++++++++++++ .../IrJsCodegenBoxES6TestGenerated.java | 157 ++++++++++++++++++ .../IrJsCodegenInlineES6TestGenerated.java | 142 ++++++++++++++++ .../IrJsCodegenBoxTestGenerated.java | 157 ++++++++++++++++++ .../IrJsCodegenInlineTestGenerated.java | 142 ++++++++++++++++ .../semantics/JsCodegenBoxTestGenerated.java | 157 ++++++++++++++++++ .../JsCodegenInlineTestGenerated.java | 142 ++++++++++++++++ 59 files changed, 4371 insertions(+) create mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/any.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/anyN.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/iface.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/primitive.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/string.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/any.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/string.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/any.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/anyN.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/iface.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/primitive.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/funInterface/string.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/any.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/anyN.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/iface.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/ifaceChild.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/primitive.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/lambda/string.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/any.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/anyN.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/iface.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/ifaceChild.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/primitive.kt create mode 100644 compiler/testData/codegen/boxInline/inlineClasses/unboxGenericParameter/objectLiteral/string.kt 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")