diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 7fd261a1a29..3a1e113e60c 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -17036,6 +17036,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/inlineClasses/functionsJvmSignaturesConflictOnInheritance.kt"); } + @Test + @TestMetadata("genericInlineClass.kt") + public void testGenericInlineClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/genericInlineClass.kt"); + } + @Test @TestMetadata("identityComparisonWithInlineClasses.kt") public void testIdentityComparisonWithInlineClasses() throws Exception { @@ -17132,6 +17138,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/inlineClasses/recursiveInlineClasses.kt"); } + @Test + @TestMetadata("reifiedGenericUnderlyingType.kt") + public void testReifiedGenericUnderlyingType() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/reifiedGenericUnderlyingType.kt"); + } + @Test @TestMetadata("reservedMembersAndConstructsInsideInlineClass.kt") public void testReservedMembersAndConstructsInsideInlineClass() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index e0b118c1d37..698f881c3ff 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -17036,6 +17036,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/inlineClasses/functionsJvmSignaturesConflictOnInheritance.kt"); } + @Test + @TestMetadata("genericInlineClass.kt") + public void testGenericInlineClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/genericInlineClass.kt"); + } + @Test @TestMetadata("identityComparisonWithInlineClasses.kt") public void testIdentityComparisonWithInlineClasses() throws Exception { @@ -17132,6 +17138,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/inlineClasses/recursiveInlineClasses.kt"); } + @Test + @TestMetadata("reifiedGenericUnderlyingType.kt") + public void testReifiedGenericUnderlyingType() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/reifiedGenericUnderlyingType.kt"); + } + @Test @TestMetadata("reservedMembersAndConstructsInsideInlineClass.kt") public void testReservedMembersAndConstructsInsideInlineClass() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 18ad4aad15d..81edd2d2899 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -21663,6 +21663,28 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue") + @TestDataPath("$PROJECT_ROOT") + public class GenericUnderlyingValue { + @Test + public void testAllFilesPresentInGenericUnderlyingValue() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt"); + } + + @Test + @TestMetadata("upperBound.kt") + public void testUpperBound() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/inlineClasses/hiddenConstructor") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt index d7748774d41..3d51798ad8a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt @@ -95,7 +95,6 @@ object InlineClassDeclarationChecker : DeclarationChecker { val baseParameterTypes = descriptor.safeAs()?.defaultType?.substitutedUnderlyingTypes() ?: emptyList() for ((baseParameter, baseParameterType) in primaryConstructor.valueParameters zip baseParameterTypes) { - if (!isParameterAcceptableForInlineClass(baseParameter)) { trace.report(Errors.VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER.on(baseParameter)) baseParametersOk = false @@ -104,7 +103,10 @@ object InlineClassDeclarationChecker : DeclarationChecker { val baseParameterTypeReference = baseParameter.typeReference if (baseParameterType != null && baseParameterTypeReference != null) { - if (baseParameterType.isInapplicableParameterType()) { + if (baseParameterType.isInapplicableParameterType() && + !(context.languageVersionSettings.supportsFeature(LanguageFeature.GenericInlineClassParameter) && + (baseParameterType.isTypeParameter() || baseParameterType.isGenericArrayOfTypeParameter())) + ) { trace.report(Errors.VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE.on(baseParameterTypeReference, baseParameterType)) baseParametersOk = false continue diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt index 0a3d7af27d2..00efd8c3d2e 100644 --- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt +++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase import org.jetbrains.kotlin.backend.common.pop import org.jetbrains.kotlin.backend.common.push import org.jetbrains.kotlin.backend.jvm.* +import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.config.ApiVersion import org.jetbrains.kotlin.descriptors.DescriptorVisibilities @@ -29,10 +30,7 @@ import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.IrValueSymbol import org.jetbrains.kotlin.ir.transformStatement -import org.jetbrains.kotlin.ir.types.IrType -import org.jetbrains.kotlin.ir.types.classOrNull -import org.jetbrains.kotlin.ir.types.isNullable -import org.jetbrains.kotlin.ir.types.makeNotNull +import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.load.java.JvmAbi @@ -68,7 +66,9 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F } } - override fun lower(irFile: IrFile) = irFile.transformChildrenVoid() + override fun lower(irFile: IrFile) { + irFile.transformChildrenVoid() + } override fun visitClassNew(declaration: IrClass): IrStatement { // The arguments to the primary constructor are in scope in the initializers of IrFields. @@ -325,12 +325,24 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F } } - private fun coerceInlineClasses(argument: IrExpression, from: IrType, to: IrType) = - IrCallImpl.fromSymbolOwner(UNDEFINED_OFFSET, UNDEFINED_OFFSET, to, context.ir.symbols.unsafeCoerceIntrinsic).apply { - putTypeArgument(0, from) - putTypeArgument(1, to) - putValueArgument(0, argument) + private fun coerceInlineClasses(argument: IrExpression, from: IrType, to: IrType): IrExpression { + return IrCallImpl.fromSymbolOwner(UNDEFINED_OFFSET, UNDEFINED_OFFSET, to, context.ir.symbols.unsafeCoerceIntrinsic).apply { + val underlyingType = from.erasedUpperBound.inlineClassRepresentation?.underlyingType + if (underlyingType?.isTypeParameter() == true) { + putTypeArgument(0, from) + putTypeArgument(1, underlyingType) + putValueArgument( + 0, IrTypeOperatorCallImpl( + UNDEFINED_OFFSET, UNDEFINED_OFFSET, to, IrTypeOperator.IMPLICIT_CAST, underlyingType, argument + ) + ) + } else { + putTypeArgument(0, from) + putTypeArgument(1, to) + putValueArgument(0, argument) + } } + } private fun IrExpression.coerceToUnboxed() = coerceInlineClasses(this, this.type, this.type.unboxInlineClass()) diff --git a/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt b/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt new file mode 100644 index 00000000000..6a9b26d8a5b --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt @@ -0,0 +1,6 @@ +// CHECK_BYTECODE_LISTING +// LANGUAGE: -JvmInlineValueClasses, +GenericInlineClassParameter + +inline class ICAny(val value: T) + +fun box(): String = ICAny("OK").value \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.txt b/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.txt new file mode 100644 index 00000000000..ab24aded1c6 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.txt @@ -0,0 +1,24 @@ +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class ICAny { + // source: 'simple.kt' + private final field value: java.lang.Object + private synthetic method (p0: java.lang.Object): void + public synthetic final static method box-impl(p0: java.lang.Object): ICAny + public static @org.jetbrains.annotations.NotNull method constructor-impl(p0: java.lang.Object): java.lang.Object + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.Object, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.Object, p1: java.lang.Object): boolean + public final method getValue(): java.lang.Object + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.Object): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.Object): java.lang.String + public synthetic final method unbox-impl(): java.lang.Object +} + +@kotlin.Metadata +public final class SimpleKt { + // source: 'simple.kt' + public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String +} diff --git a/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt b/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt new file mode 100644 index 00000000000..2ec47965f7f --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt @@ -0,0 +1,6 @@ +// CHECK_BYTECODE_LISTING +// LANGUAGE: -JvmInlineValueClasses, +GenericInlineClassParameter + +inline class ICString(val value: T) + +fun box(): String = ICString("OK").value \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.txt b/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.txt new file mode 100644 index 00000000000..58f88e11557 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.txt @@ -0,0 +1,24 @@ +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class ICString { + // source: 'upperBound.kt' + private final @org.jetbrains.annotations.NotNull field value: java.lang.String + private synthetic method (p0: java.lang.String): void + public synthetic final static method box-impl(p0: java.lang.String): ICString + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean + public final @org.jetbrains.annotations.NotNull method getValue(): java.lang.String + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.String): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.String): java.lang.String + public synthetic final method unbox-impl(): java.lang.String +} + +@kotlin.Metadata +public final class UpperBoundKt { + // source: 'upperBound.kt' + public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String +} diff --git a/compiler/testData/diagnostics/tests/inlineClasses/genericInlineClass.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/genericInlineClass.fir.kt new file mode 100644 index 00000000000..3f10052f55d --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/genericInlineClass.fir.kt @@ -0,0 +1,8 @@ +// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses, +GenericInlineClassParameter +// SKIP_TXT + +inline class ICAny(val value: T) + +inline class ICArray(val value: Array) + +inline class ICList(val value: List) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/genericInlineClass.kt b/compiler/testData/diagnostics/tests/inlineClasses/genericInlineClass.kt new file mode 100644 index 00000000000..fdf8c1d8f43 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/genericInlineClass.kt @@ -0,0 +1,8 @@ +// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses, +GenericInlineClassParameter +// SKIP_TXT + +inline class ICAny(val value: T) + +inline class ICArray(val value: Array) + +inline class ICList(val value: List) diff --git a/compiler/testData/diagnostics/tests/inlineClasses/reifiedGenericUnderlyingType.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/reifiedGenericUnderlyingType.fir.kt new file mode 100644 index 00000000000..30e5c8eda50 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/reifiedGenericUnderlyingType.fir.kt @@ -0,0 +1,4 @@ +// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses +// SKIP_TXT + +inline class ICAny(val value: T) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/reifiedGenericUnderlyingType.kt b/compiler/testData/diagnostics/tests/inlineClasses/reifiedGenericUnderlyingType.kt new file mode 100644 index 00000000000..6f5b14ddf7c --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/reifiedGenericUnderlyingType.kt @@ -0,0 +1,4 @@ +// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses +// SKIP_TXT + +inline class ICAny<reified T>(val value: T) diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 3d422d6bf85..8d472172a07 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -17042,6 +17042,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/inlineClasses/functionsJvmSignaturesConflictOnInheritance.kt"); } + @Test + @TestMetadata("genericInlineClass.kt") + public void testGenericInlineClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/genericInlineClass.kt"); + } + @Test @TestMetadata("identityComparisonWithInlineClasses.kt") public void testIdentityComparisonWithInlineClasses() throws Exception { @@ -17138,6 +17144,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/inlineClasses/recursiveInlineClasses.kt"); } + @Test + @TestMetadata("reifiedGenericUnderlyingType.kt") + public void testReifiedGenericUnderlyingType() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/reifiedGenericUnderlyingType.kt"); + } + @Test @TestMetadata("reservedMembersAndConstructsInsideInlineClass.kt") public void testReservedMembersAndConstructsInsideInlineClass() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index d10530c8ca5..a06742d974e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -21243,6 +21243,28 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue") + @TestDataPath("$PROJECT_ROOT") + public class GenericUnderlyingValue { + @Test + public void testAllFilesPresentInGenericUnderlyingValue() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt"); + } + + @Test + @TestMetadata("upperBound.kt") + public void testUpperBound() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/inlineClasses/hiddenConstructor") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 56d405b47e5..fb281f849a5 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -21663,6 +21663,28 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue") + @TestDataPath("$PROJECT_ROOT") + public class GenericUnderlyingValue { + @Test + public void testAllFilesPresentInGenericUnderlyingValue() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt"); + } + + @Test + @TestMetadata("upperBound.kt") + public void testUpperBound() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/inlineClasses/hiddenConstructor") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 10f798d5858..d73a4828dc0 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -17768,6 +17768,29 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class GenericUnderlyingValue extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInGenericUnderlyingValue() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt"); + } + + @TestMetadata("upperBound.kt") + public void testUpperBound() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/hiddenConstructor") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 41376bf3d26..1a576dee1e7 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -291,6 +291,7 @@ enum class LanguageFeature( JsAllowValueClassesInExternals(sinceVersion = null, defaultState = State.DISABLED, kind = UNSTABLE_FEATURE), ContextReceivers(sinceVersion = null, defaultState = State.DISABLED, kind = UNSTABLE_FEATURE), KotlinFunInterfaceConstructorReference(sinceVersion = null, defaultState = State.DISABLED, kind = UNSTABLE_FEATURE), + GenericInlineClassParameter(sinceVersion = null, defaultState = State.ENABLED_WITH_WARNING, kind = UNSTABLE_FEATURE), ValueClasses(sinceVersion = null, defaultState = State.DISABLED, kind = UNSTABLE_FEATURE), ; diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index a065cb3b51f..4a7e63d7c0a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -16835,6 +16835,28 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue") + @TestDataPath("$PROJECT_ROOT") + public class GenericUnderlyingValue { + @Test + public void testAllFilesPresentInGenericUnderlyingValue() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt"); + } + + @Test + @TestMetadata("upperBound.kt") + public void testUpperBound() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/inlineClasses/hiddenConstructor") @TestDataPath("$PROJECT_ROOT") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index e6182b87dee..4955677752a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -16799,6 +16799,28 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue") + @TestDataPath("$PROJECT_ROOT") + public class GenericUnderlyingValue { + @Test + public void testAllFilesPresentInGenericUnderlyingValue() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt"); + } + + @Test + @TestMetadata("upperBound.kt") + public void testUpperBound() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/inlineClasses/hiddenConstructor") @TestDataPath("$PROJECT_ROOT") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 761e8131c23..0114abe1c8f 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -14227,6 +14227,29 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class GenericUnderlyingValue extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInGenericUnderlyingValue() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt"); + } + + @TestMetadata("upperBound.kt") + public void testUpperBound() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/hiddenConstructor") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index b4f860a3393..077f0d479d1 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -18484,6 +18484,29 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest } } + @Nested + @TestMetadata("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue") + @TestDataPath("$PROJECT_ROOT") + @NativeBlackBoxTestCaseGroupProvider(ExtTestCaseGroupProvider.class) + public class GenericUnderlyingValue { + @Test + public void testAllFilesPresentInGenericUnderlyingValue() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/simple.kt"); + } + + @Test + @TestMetadata("upperBound.kt") + public void testUpperBound() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/genericUnderlyingValue/upperBound.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/inlineClasses/hiddenConstructor") @TestDataPath("$PROJECT_ROOT")