diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java index 14d75f07fbb..aab2040a882 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java @@ -31060,6 +31060,36 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @Test + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @Test + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @Test @TestMetadata("protectedField.kt") public void testProtectedField() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index 6977f48abf7..ecb3775a5e9 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java @@ -31060,6 +31060,36 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @Test + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @Test + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @Test @TestMetadata("protectedField.kt") public void testProtectedField() throws Exception { diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/Fir2IrJvmSpecialAnnotationSymbolProvider.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/Fir2IrJvmSpecialAnnotationSymbolProvider.kt index f0a3c021dd4..20011fe7773 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/Fir2IrJvmSpecialAnnotationSymbolProvider.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/Fir2IrJvmSpecialAnnotationSymbolProvider.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.ir.symbols.impl.DescriptorlessExternalPackageFragmen import org.jetbrains.kotlin.ir.util.createImplicitParameterDeclarationWithWrappedDescriptor import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.StandardClassIds.Annotations.EnhancedNullability +import org.jetbrains.kotlin.name.StandardClassIds.Annotations.FlexibleArrayElementVariance import org.jetbrains.kotlin.name.StandardClassIds.Annotations.FlexibleMutability import org.jetbrains.kotlin.name.StandardClassIds.Annotations.FlexibleNullability import org.jetbrains.kotlin.name.StandardClassIds.Annotations.RawTypeAnnotation @@ -43,6 +44,7 @@ class Fir2IrJvmSpecialAnnotationSymbolProvider : Fir2IrSpecialSymbolProvider() { FlexibleNullability -> id.toIrClass(kotlinInternalIrPackage).symbol FlexibleMutability -> id.toIrClass(kotlinInternalIrPackage).symbol RawTypeAnnotation -> id.toIrClass(kotlinInternalIrPackage).symbol + FlexibleArrayElementVariance -> id.toIrClass(kotlinInternalIrPackage).symbol else -> null } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrBuiltIns.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrBuiltIns.kt index a6c7d81cc35..e4eda23d5df 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrBuiltIns.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrBuiltIns.kt @@ -49,6 +49,13 @@ class Fir2IrBuiltIns( internal fun flexibleMutabilityAnnotationConstructorCall(): IrConstructorCall? = flexibleMutabilityAnnotationSymbol?.toConstructorCall() + private val flexibleArrayElementVarianceAnnotationSymbol by lazy { + specialAnnotationIrSymbolById(StandardClassIds.Annotations.FlexibleArrayElementVariance) + } + + internal fun flexibleArrayElementVarianceAnnotationConstructorCall(): IrConstructorCall? = + flexibleArrayElementVarianceAnnotationSymbol?.toConstructorCall() + private val rawTypeAnnotationSymbol by lazy { specialAnnotationIrSymbolById(StandardClassIds.Annotations.RawTypeAnnotation) } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt index 02a0d673bea..3a5ffa299ce 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt @@ -16,14 +16,11 @@ import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.* import org.jetbrains.kotlin.ir.expressions.IrConstructorCall import org.jetbrains.kotlin.ir.symbols.IrClassSymbol -import org.jetbrains.kotlin.ir.types.IrType -import org.jetbrains.kotlin.ir.types.IrTypeArgument -import org.jetbrains.kotlin.ir.types.IrTypeProjection +import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.types.impl.IrDynamicTypeImpl import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection -import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.name.StandardClassIds.Annotations.ExtensionFunctionType @@ -99,6 +96,7 @@ class Fir2IrTypeConverter( annotations: List = emptyList(), hasFlexibleNullability: Boolean = false, hasFlexibleMutability: Boolean = false, + hasFlexibleArrayElementVariance: Boolean = false, addRawTypeAnnotation: Boolean = false ): IrType { return when (this) { @@ -132,6 +130,11 @@ class Fir2IrTypeConverter( typeAnnotations += it } } + if (hasFlexibleArrayElementVariance) { + builtIns.flexibleArrayElementVarianceAnnotationConstructorCall()?.let { + typeAnnotations += it + } + } if (isExtensionFunctionType && annotations.getAnnotationsByClassId(ExtensionFunctionType, session).isEmpty()) { builtIns.extensionFunctionTypeAnnotationConstructorCall()?.let { @@ -169,6 +172,7 @@ class Fir2IrTypeConverter( annotations, hasFlexibleNullability = lowerBound.nullability != upperBound.nullability, hasFlexibleMutability = isMutabilityFlexible(), + hasFlexibleArrayElementVariance = false, addRawTypeAnnotation = true ) } @@ -189,14 +193,16 @@ class Fir2IrTypeConverter( typeOrigin, annotations, hasFlexibleNullability = lower.nullability != upper.nullability, - hasFlexibleMutability = isMutabilityFlexible() + hasFlexibleMutability = isMutabilityFlexible(), + hasFlexibleArrayElementVariance = hasFlexibleArrayElementVariance(), ) } else { upperBound.toIrType( typeOrigin, annotations, hasFlexibleNullability = lowerBound.nullability != upperBound.nullability, - hasFlexibleMutability = isMutabilityFlexible() + hasFlexibleMutability = isMutabilityFlexible(), + hasFlexibleArrayElementVariance = false, ) } } @@ -231,6 +237,15 @@ class Fir2IrTypeConverter( } } + private fun ConeFlexibleType.hasFlexibleArrayElementVariance(): Boolean = + lowerBound.let { lowerBound -> + lowerBound is ConeClassLikeType && lowerBound.lookupTag.classId == StandardClassIds.Array && + lowerBound.typeArguments.single().kind == ProjectionKind.INVARIANT + } && upperBound.let { upperBound -> + upperBound is ConeClassLikeType && upperBound.lookupTag.classId == StandardClassIds.Array && + upperBound.typeArguments.single().kind == ProjectionKind.OUT + } + private fun ConeFlexibleType.isMutabilityFlexible(): Boolean { val lowerFqName = lowerBound.classId?.asSingleFqName() ?: return false val upperFqName = upperBound.classId?.asSingleFqName() ?: return false diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index ea31646e3f3..92441bb7af0 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -30675,6 +30675,36 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @Test + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @Test + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @Test @TestMetadata("protectedField.kt") public void testProtectedField() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java index 85e68492a9f..606a1588905 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java @@ -30675,6 +30675,36 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @Test + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @Test + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @Test @TestMetadata("protectedField.kt") public void testProtectedField() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 7f033cf8af3..8b27e8f078e 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -30675,6 +30675,36 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @Test + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @Test + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @Test @TestMetadata("protectedField.kt") public void testProtectedField() throws Exception { diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt index b3a5d3feb99..aa019163647 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt @@ -1156,6 +1156,9 @@ class JvmSymbols( val RAW_TYPE_ANNOTATION_FQ_NAME: FqName = StandardClassIds.Annotations.RawTypeAnnotation.asSingleFqName() + + val FLEXIBLE_VARIANCE_ANNOTATION_FQ_NAME: FqName = + StandardClassIds.Annotations.FlexibleArrayElementVariance.asSingleFqName() } } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrJvmFlexibleType.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrJvmFlexibleType.kt index 960a4921423..1891c60702f 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrJvmFlexibleType.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrJvmFlexibleType.kt @@ -6,16 +6,20 @@ package org.jetbrains.kotlin.backend.jvm.ir import org.jetbrains.kotlin.backend.jvm.JvmSymbols +import org.jetbrains.kotlin.backend.jvm.JvmSymbols.Companion.FLEXIBLE_VARIANCE_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.ir.IrBuiltIns import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl import org.jetbrains.kotlin.ir.types.impl.buildSimpleType +import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable import org.jetbrains.kotlin.ir.util.hasAnnotation import org.jetbrains.kotlin.ir.util.render +import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.types.FlexibleTypeBoundsChecker +import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.types.model.FlexibleTypeMarker internal interface IrJvmFlexibleType : FlexibleTypeMarker { @@ -23,13 +27,22 @@ internal interface IrJvmFlexibleType : FlexibleTypeMarker { val upperBound: IrSimpleType } +/** + * @param arrayVariance used for representing array types loaded from Java. + * Java type `X[]` is loaded in Kotlin as `Array..Array?` (where flexible nullability is handled by [nullability]). + */ private class IrJvmFlexibleTypeImpl( val irType: IrSimpleType, val builtIns: IrBuiltIns, val nullability: Boolean, val mutability: Boolean, + val arrayVariance: Boolean, val raw: Boolean, ) : IrJvmFlexibleType { + init { + check(!arrayVariance || !raw) { "Flexible variance is only possible for Array types, which cannot be raw: ${irType.render()}" } + } + override val lowerBound: IrSimpleType get() = irType.buildSimpleType { if (this@IrJvmFlexibleTypeImpl.nullability) nullability = SimpleTypeNullability.NOT_SPECIFIED @@ -52,7 +65,9 @@ private class IrJvmFlexibleTypeImpl( else -> error("Mutability-flexible type with unknown classifier: ${irType.render()}, FQ name: $readonlyClassFqName") } } - + if (arrayVariance) { + arguments = listOf(makeTypeProjection(irType.getArrayElementType(), Variance.INVARIANT)) + } } override val upperBound: IrSimpleType @@ -74,11 +89,21 @@ private class IrJvmFlexibleTypeImpl( else -> error("Mutability-flexible type with unknown classifier: ${irType.render()}, FQ name: $readonlyClassFqName") } } + if (arrayVariance) { + arguments = listOf(makeTypeProjection(irType.getArrayElementType(), Variance.OUT_VARIANCE)) + } if (raw) { arguments = List(arguments.size) { IrStarProjectionImpl } } kotlinType = null } + + private fun IrSimpleType.getArrayElementType(): IrType = + when (val argument = arguments.singleOrNull()) { + is IrTypeProjection -> argument.type + is IrStarProjection -> error("Star projection is not possible for the argument of Array type: ${irType.render()}") + null -> error("Flexible variance is only possible for Array types: ${irType.render()}") + } } fun IrType.isWithFlexibleNullability(): Boolean = @@ -87,20 +112,25 @@ fun IrType.isWithFlexibleNullability(): Boolean = internal fun IrType.isWithFlexibleMutability(): Boolean = hasAnnotation(JvmSymbols.FLEXIBLE_MUTABILITY_ANNOTATION_FQ_NAME) +private fun IrType.isWithFlexibleVariance(): Boolean = + hasAnnotation(StandardClassIds.Annotations.FlexibleArrayElementVariance) + internal fun IrType.asJvmFlexibleType(builtIns: IrBuiltIns): FlexibleTypeMarker? { if (this !is IrSimpleType || annotations.isEmpty()) return null val nullability = isWithFlexibleNullability() val mutability = isWithFlexibleMutability() + val flexibleVariance = isWithFlexibleVariance() val raw = isRawType() - if (!nullability && !mutability && !raw) return null + if (!nullability && !mutability && !flexibleVariance && !raw) return null val baseType = this.removeAnnotations { irCtorCall -> val fqName = irCtorCall.type.classFqName fqName == JvmSymbols.FLEXIBLE_NULLABILITY_ANNOTATION_FQ_NAME || fqName == JvmSymbols.FLEXIBLE_MUTABILITY_ANNOTATION_FQ_NAME || + fqName == FLEXIBLE_VARIANCE_ANNOTATION_FQ_NAME || fqName == JvmSymbols.RAW_TYPE_ANNOTATION_FQ_NAME } as IrSimpleType - return IrJvmFlexibleTypeImpl(baseType, builtIns, nullability, mutability, raw) + return IrJvmFlexibleTypeImpl(baseType, builtIns, nullability, mutability, flexibleVariance, raw) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/CopyIrTreeWithSymbolsForFakeOverrides.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/CopyIrTreeWithSymbolsForFakeOverrides.kt index 252f62a79f9..b934666520c 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/CopyIrTreeWithSymbolsForFakeOverrides.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/CopyIrTreeWithSymbolsForFakeOverrides.kt @@ -106,7 +106,7 @@ class CopyIrTreeWithSymbolsForFakeOverrides( } private companion object { - // TODO: RawTypeAnnotation, FlexibleMutability, EnhancedNullability? + // TODO (KT-64715): RawTypeAnnotation, FlexibleMutability, EnhancedNullability, RawType, FlexibleArrayElementVariance? val TYPE_ANNOTATIONS_TO_MERGE = listOf( FlexibleNullability.asSingleFqName(), ) diff --git a/compiler/testData/codegen/box/annotations/javaTargetOnPrimaryCtorParameter.fir.ir.txt b/compiler/testData/codegen/box/annotations/javaTargetOnPrimaryCtorParameter.fir.ir.txt index 3e573277564..da3cfdf09f7 100644 --- a/compiler/testData/codegen/box/annotations/javaTargetOnPrimaryCtorParameter.fir.ir.txt +++ b/compiler/testData/codegen/box/annotations/javaTargetOnPrimaryCtorParameter.fir.ir.txt @@ -88,8 +88,8 @@ FILE fqName: fileName:/test.kt $receiver: CALL 'public final fun map (transform: kotlin.Function1): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null : @[FlexibleNullability] kotlin.Annotation? : kotlin.String - $receiver: TYPE_OP type=kotlin.Array origin=IMPLICIT_NOTNULL typeOperand=kotlin.Array - CALL 'public open fun getAnnotations (): @[FlexibleNullability] kotlin.Array? declared in java.lang.reflect.Field' type=@[FlexibleNullability] kotlin.Array? origin=GET_PROPERTY + $receiver: TYPE_OP type=@[FlexibleArrayElementVariance] kotlin.Array origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleArrayElementVariance] kotlin.Array + CALL 'public open fun getAnnotations (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.lang.reflect.Field' type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? origin=GET_PROPERTY $this: CALL 'public open fun getDeclaredField (p0: @[FlexibleNullability] kotlin.String?): @[FlexibleNullability] java.lang.reflect.Field? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.reflect.Field? origin=null $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.Foo> origin=GET_PROPERTY : .Foo diff --git a/compiler/testData/codegen/box/annotations/targetOnPrimaryCtorParameter.fir.ir.txt b/compiler/testData/codegen/box/annotations/targetOnPrimaryCtorParameter.fir.ir.txt index 612187e801c..11c2b28b052 100644 --- a/compiler/testData/codegen/box/annotations/targetOnPrimaryCtorParameter.fir.ir.txt +++ b/compiler/testData/codegen/box/annotations/targetOnPrimaryCtorParameter.fir.ir.txt @@ -247,8 +247,8 @@ FILE fqName: fileName:/targetOnPrimaryCtorParameter.kt $receiver: CALL 'public final fun map (transform: kotlin.Function1): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null : @[FlexibleNullability] kotlin.Annotation? : kotlin.String - $receiver: TYPE_OP type=kotlin.Array origin=IMPLICIT_NOTNULL typeOperand=kotlin.Array - CALL 'public open fun getAnnotations (): @[FlexibleNullability] kotlin.Array? declared in java.lang.reflect.Field' type=@[FlexibleNullability] kotlin.Array? origin=GET_PROPERTY + $receiver: TYPE_OP type=@[FlexibleArrayElementVariance] kotlin.Array origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleArrayElementVariance] kotlin.Array + CALL 'public open fun getAnnotations (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.lang.reflect.Field' type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? origin=GET_PROPERTY $this: CALL 'public open fun getDeclaredField (p0: @[FlexibleNullability] kotlin.String?): @[FlexibleNullability] java.lang.reflect.Field? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.reflect.Field? origin=null $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.Foo> origin=GET_PROPERTY : .Foo diff --git a/compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt b/compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt new file mode 100644 index 00000000000..dae536d816c --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt @@ -0,0 +1,37 @@ +// TARGET_BACKEND: JVM +// FILE: J.java + +interface J { + String foo(String[] a); +} + +// FILE: 1.kt + +class Inv : J { + override fun foo(a: Array): String = a[0] +} + +class Out : J { + override fun foo(a: Array): String = a[0] +} + +class Vararg : J { + override fun foo(vararg a: String): String = a[0] +} + +class InvNullableElement : J { + override fun foo(a: Array): String = a[0] ?: "Fail" +} + +class InvNullableArray : J { + override fun foo(a: Array?): String = a?.get(0) ?: "Fail" +} + +fun box(): String { + if (Inv().foo(arrayOf("OK")) != "OK") return "Fail Inv" + if (Out().foo(arrayOf("OK")) != "OK") return "Fail Out" + if (Vararg().foo("OK") != "OK") return "Fail Vararg" + if (InvNullableElement().foo(arrayOf("OK")) != "OK") return "Fail InvNullableElement" + if (InvNullableArray().foo(arrayOf("OK")) != "OK") return "Fail InvNullableArray" + return "OK" +} diff --git a/compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt b/compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt new file mode 100644 index 00000000000..cc201cb8fc6 --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt @@ -0,0 +1,41 @@ +// TARGET_BACKEND: JVM +// FILE: J.java + +import java.util.List; + +// This is a bit more elaborate version of overrideWithArrayParameterType.kt, which also checks interaction of: +// flexible nullability, flexible mutability, raw types, varargs. +interface J { + List[] foo(List... a); +} + +// FILE: 1.kt + +class C1 : J { + override fun foo(vararg a: MutableList?): Array>? = null +} +class C2 : J { + override fun foo(vararg a: List): Array>? = null +} +class C3 : J { + override fun foo(vararg a: List<*>): Array?>? = null +} +class C4 : J { + override fun foo(vararg a: MutableList): Array>? = null +} +class C5 : J { + override fun foo(a: Array>): Array>? = null +} +class C6 : J { + override fun foo(a: Array?>): Array>? = null +} + +fun box(): String { + C1().foo() + C2().foo() + C3().foo() + C4().foo() + C5().foo(emptyArray()) + C6().foo(emptyArray()) + return "OK" +} diff --git a/compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt b/compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt new file mode 100644 index 00000000000..3031beadb6f --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt @@ -0,0 +1,34 @@ +// TARGET_BACKEND: JVM +// FILE: J.java + +import org.jetbrains.annotations.NotNull; + +interface J { + String foo(@NotNull String[] a); +} + +// FILE: 1.kt + +class Inv : J { + override fun foo(a: Array): String = a[0] +} + +class Out : J { + override fun foo(a: Array): String = a[0] +} + +class Vararg : J { + override fun foo(vararg a: String): String = a[0] +} + +class InvNullableElement : J { + override fun foo(a: Array): String = a[0] ?: "Fail" +} + +fun box(): String { + if (Inv().foo(arrayOf("OK")) != "OK") return "Fail Inv" + if (Out().foo(arrayOf("OK")) != "OK") return "Fail Out" + if (Vararg().foo("OK") != "OK") return "Fail Vararg" + if (InvNullableElement().foo(arrayOf("OK")) != "OK") return "Fail InvNullableElement" + return "OK" +} diff --git a/compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt b/compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt new file mode 100644 index 00000000000..ae8b43c516e --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt @@ -0,0 +1,21 @@ +// TARGET_BACKEND: JVM +// FILE: J.java + +import java.util.List; + +public interface J { + String foo(T t, List list); +} + +// FILE: 1.kt + +class A + +class C : J { + override fun foo(a: A, list: List>?): String = "OK" +} + +fun box(): String { + val c: J = C() + return c.foo(A(), null) +} diff --git a/compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt b/compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt new file mode 100644 index 00000000000..15f2590769e --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt @@ -0,0 +1,27 @@ +// TARGET_BACKEND: JVM +// FILE: J.java + +interface J { + String foo(String... a); +} + +// FILE: 1.kt + +class Inv : J { + override fun foo(a: Array): String = a[0] +} + +class Out : J { + override fun foo(a: Array): String = a[0] +} + +class Vararg : J { + override fun foo(vararg a: String): String = a[0] +} + +fun box(): String { + if (Inv().foo(arrayOf("OK")) != "OK") return "Fail Inv" + if (Out().foo(arrayOf("OK")) != "OK") return "Fail Out" + if (Vararg().foo("OK") != "OK") return "Fail Vararg" + return "OK" +} diff --git a/compiler/testData/ir/irText/firProblems/ArrayListOverrides.fir.ir.txt b/compiler/testData/ir/irText/firProblems/ArrayListOverrides.fir.ir.txt index 9eb71776ed9..e6703a9d18c 100644 --- a/compiler/testData/ir/irText/firProblems/ArrayListOverrides.fir.ir.txt +++ b/compiler/testData/ir/irText/firProblems/ArrayListOverrides.fir.ir.txt @@ -46,16 +46,16 @@ FILE fqName: fileName:/ArrayListOverrides.kt overridden: public open fun clone (): @[EnhancedNullability] kotlin.Any declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList - FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList) returnType:@[FlexibleNullability] kotlin.Array? [fake_override] + FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? [fake_override] overridden: - public open fun toArray (): @[FlexibleNullability] kotlin.Array? declared in java.util.ArrayList + public open fun toArray (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList - FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN ($this:java.util.ArrayList, p0:@[FlexibleNullability] kotlin.Array.A1.toArray?>?) returnType:@[FlexibleNullability] kotlin.Array.A1.toArray?>? [fake_override] + FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN ($this:java.util.ArrayList, p0:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.A1.toArray?>?) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.A1.toArray?>? [fake_override] overridden: - public open fun toArray (p0: @[FlexibleNullability] kotlin.Array?): @[FlexibleNullability] kotlin.Array? declared in java.util.ArrayList + public open fun toArray (p0: @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array?): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.util.ArrayList TYPE_PARAMETER name:T index:0 variance: superTypes:[@[FlexibleNullability] kotlin.Any?] reified:false $this: VALUE_PARAMETER name: type:java.util.ArrayList - VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] kotlin.Array.A1.toArray?>? + VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.A1.toArray?>? FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:java.util.ArrayList, p0:kotlin.Int) returnType:@[EnhancedNullability] kotlin.String [fake_override,operator] overridden: public open fun get (p0: kotlin.Int): @[EnhancedNullability] E of java.util.ArrayList declared in java.util.ArrayList @@ -243,16 +243,16 @@ FILE fqName: fileName:/ArrayListOverrides.kt overridden: public open fun clone (): @[EnhancedNullability] kotlin.Any declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList - FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList) returnType:@[FlexibleNullability] kotlin.Array? [fake_override] + FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? [fake_override] overridden: - public open fun toArray (): @[FlexibleNullability] kotlin.Array? declared in java.util.ArrayList + public open fun toArray (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList - FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN ($this:java.util.ArrayList, p0:@[FlexibleNullability] kotlin.Array.A2.toArray?>?) returnType:@[FlexibleNullability] kotlin.Array.A2.toArray?>? [fake_override] + FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN ($this:java.util.ArrayList, p0:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.A2.toArray?>?) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.A2.toArray?>? [fake_override] overridden: - public open fun toArray (p0: @[FlexibleNullability] kotlin.Array?): @[FlexibleNullability] kotlin.Array? declared in java.util.ArrayList + public open fun toArray (p0: @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array?): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.util.ArrayList TYPE_PARAMETER name:T index:0 variance: superTypes:[@[FlexibleNullability] kotlin.Any?] reified:false $this: VALUE_PARAMETER name: type:java.util.ArrayList - VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] kotlin.Array.A2.toArray?>? + VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.A2.toArray?>? FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:java.util.ArrayList, p0:kotlin.Int) returnType:@[EnhancedNullability] kotlin.String [fake_override,operator] overridden: public open fun get (p0: kotlin.Int): @[EnhancedNullability] E of java.util.ArrayList declared in java.util.ArrayList diff --git a/compiler/testData/ir/irText/firProblems/MultiList.fir.ir.txt b/compiler/testData/ir/irText/firProblems/MultiList.fir.ir.txt index debd99c2da4..7e2301a50fa 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.fir.ir.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.fir.ir.txt @@ -252,16 +252,16 @@ FILE fqName: fileName:/MultiList.kt overridden: public open fun (): kotlin.Int declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> - FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>) returnType:@[FlexibleNullability] kotlin.Array? [fake_override] + FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? [fake_override] overridden: - public open fun toArray (): @[FlexibleNullability] kotlin.Array? declared in java.util.ArrayList + public open fun toArray (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> - FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN ($this:java.util.ArrayList<.Some.SomeList>>, p0:@[FlexibleNullability] kotlin.Array.SomeList.toArray?>?) returnType:@[FlexibleNullability] kotlin.Array.SomeList.toArray?>? [fake_override] + FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN ($this:java.util.ArrayList<.Some.SomeList>>, p0:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.SomeList.toArray?>?) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.SomeList.toArray?>? [fake_override] overridden: - public open fun toArray (p0: @[FlexibleNullability] kotlin.Array?): @[FlexibleNullability] kotlin.Array? declared in java.util.ArrayList + public open fun toArray (p0: @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array?): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.util.ArrayList TYPE_PARAMETER name:T index:0 variance: superTypes:[@[FlexibleNullability] kotlin.Any?] reified:false $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> - VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] kotlin.Array.SomeList.toArray?>? + VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.SomeList.toArray?>? FUN FAKE_OVERRIDE name:add visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>, p0:@[EnhancedNullability] .Some.SomeList>) returnType:kotlin.Boolean [fake_override] overridden: public open fun add (p0: @[EnhancedNullability] E of java.util.ArrayList): kotlin.Boolean declared in java.util.ArrayList @@ -441,16 +441,16 @@ FILE fqName: fileName:/MultiList.kt overridden: public open fun (): kotlin.Int declared in .SomeList $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> - FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>) returnType:@[FlexibleNullability] kotlin.Array? [fake_override] + FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? [fake_override] overridden: - public open fun toArray (): @[FlexibleNullability] kotlin.Array? declared in .SomeList + public open fun toArray (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in .SomeList $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> - FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN ($this:java.util.ArrayList<.Some>, p0:@[FlexibleNullability] kotlin.Array.FinalList.toArray?>?) returnType:@[FlexibleNullability] kotlin.Array.FinalList.toArray?>? [fake_override] + FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN ($this:java.util.ArrayList<.Some>, p0:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.FinalList.toArray?>?) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.FinalList.toArray?>? [fake_override] overridden: - public open fun toArray (p0: @[FlexibleNullability] kotlin.Array.SomeList.toArray?>?): @[FlexibleNullability] kotlin.Array.SomeList.toArray?>? declared in .SomeList + public open fun toArray (p0: @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.SomeList.toArray?>?): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.SomeList.toArray?>? declared in .SomeList TYPE_PARAMETER name:T index:0 variance: superTypes:[@[FlexibleNullability] kotlin.Any?] reified:false $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> - VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] kotlin.Array.FinalList.toArray?>? + VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array.FinalList.toArray?>? FUN FAKE_OVERRIDE name:add visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>, p0:@[EnhancedNullability] .Some) returnType:kotlin.Boolean [fake_override] overridden: public open fun add (p0: @[EnhancedNullability] .Some.SomeList>): kotlin.Boolean declared in .SomeList diff --git a/compiler/testData/ir/irText/firProblems/reflectFindAnnotationOnDefaultMethodParameter.fir.ir.txt b/compiler/testData/ir/irText/firProblems/reflectFindAnnotationOnDefaultMethodParameter.fir.ir.txt index 0931818d10d..453ad88055d 100644 --- a/compiler/testData/ir/irText/firProblems/reflectFindAnnotationOnDefaultMethodParameter.fir.ir.txt +++ b/compiler/testData/ir/irText/firProblems/reflectFindAnnotationOnDefaultMethodParameter.fir.ir.txt @@ -36,18 +36,18 @@ FILE fqName: fileName:/reflectFindAnnotationOnDefaultMethodParameter.kt : .box. $receiver: GET_VAR 'val impl: .box. declared in .box' type=.box. origin=null p0: CONST String type=kotlin.String value="m" - p1: VARARG type=@[FlexibleNullability] kotlin.Array?>? varargElementType=@[FlexibleNullability] java.lang.Class<*>? + p1: VARARG type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array?>? varargElementType=@[FlexibleNullability] java.lang.Class<*>? CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class origin=GET_PROPERTY : kotlin.String $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public superTypes:[kotlin.Comparable; kotlin.CharSequence; java.io.Serializable]' type=kotlin.reflect.KClass VAR name:parameter type:@[FlexibleNullability] java.lang.reflect.Parameter? [val] CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=@[FlexibleNullability] java.lang.reflect.Parameter? origin=null - $this: CALL 'public open fun getParameters (): @[FlexibleNullability] kotlin.Array? declared in java.lang.reflect.Method' type=@[FlexibleNullability] kotlin.Array? origin=GET_PROPERTY + $this: CALL 'public open fun getParameters (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.lang.reflect.Method' type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? origin=GET_PROPERTY $this: GET_VAR 'val method: @[FlexibleNullability] java.lang.reflect.Method? declared in .box' type=@[FlexibleNullability] java.lang.reflect.Method? origin=null index: CONST Int type=kotlin.Int value=0 VAR name:size type:kotlin.Int [val] CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY - $this: CALL 'public open fun getAnnotations (): @[FlexibleNullability] kotlin.Array? declared in java.lang.reflect.Parameter' type=@[FlexibleNullability] kotlin.Array? origin=GET_PROPERTY + $this: CALL 'public open fun getAnnotations (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.lang.reflect.Parameter' type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? origin=GET_PROPERTY $this: GET_VAR 'val parameter: @[FlexibleNullability] java.lang.reflect.Parameter? declared in .box' type=@[FlexibleNullability] java.lang.reflect.Parameter? origin=null WHEN type=kotlin.Unit origin=IF BRANCH diff --git a/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.ir.txt b/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.ir.txt new file mode 100644 index 00000000000..1aeea06f710 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.ir.txt @@ -0,0 +1,8 @@ +FILE fqName: fileName:/throwableStackTrace.kt + FUN name:foo visibility:public modality:FINAL <> (t:kotlin.Throwable) returnType:kotlin.Unit + VALUE_PARAMETER name:t index:0 type:kotlin.Throwable + BLOCK_BODY + CALL 'public open fun setStackTrace (p0: @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array?): kotlin.Unit declared in kotlin.Throwable' type=kotlin.Unit origin=EQ + $this: GET_VAR 't: kotlin.Throwable declared in .foo' type=kotlin.Throwable origin=null + p0: CALL 'public open fun getStackTrace (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in kotlin.Throwable' type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? origin=GET_PROPERTY + $this: GET_VAR 't: kotlin.Throwable declared in .foo' type=kotlin.Throwable origin=null diff --git a/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.kt.txt b/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.kt.txt new file mode 100644 index 00000000000..33e6667ac65 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.kt.txt @@ -0,0 +1,3 @@ +fun foo(t: Throwable) { + t.setStackTrace(p0 = t.getStackTrace()) +} diff --git a/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt b/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt index 97dcbb9bb4f..abdc8f217bb 100644 --- a/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt +++ b/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt @@ -1,8 +1,7 @@ // TARGET_BACKEND: JVM -// FIR_IDENTICAL // WITH_STDLIB // FULL_JDK fun foo(t: Throwable) { t.stackTrace = t.stackTrace -} \ No newline at end of file +} diff --git a/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.ir.txt b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.ir.txt index 6813f4bb0cf..17f38f681bd 100644 --- a/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.ir.txt +++ b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.ir.txt @@ -1,9 +1,9 @@ FILE fqName: fileName:/jdkClassSyntheticProperty.kt PROPERTY name:test visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL <> ($receiver:java.lang.Class<*>) returnType:@[FlexibleNullability] kotlin.Array? + FUN name: visibility:public modality:FINAL <> ($receiver:java.lang.Class<*>) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? correspondingProperty: PROPERTY name:test visibility:public modality:FINAL [val] $receiver: VALUE_PARAMETER name: type:java.lang.Class<*> BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): @[FlexibleNullability] kotlin.Array? declared in ' - CALL 'public open fun getDeclaredFields (): @[FlexibleNullability] kotlin.Array? declared in java.lang.Class' type=@[FlexibleNullability] kotlin.Array? origin=GET_PROPERTY + RETURN type=kotlin.Nothing from='public final fun (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in ' + CALL 'public open fun getDeclaredFields (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.lang.Class' type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? origin=GET_PROPERTY $this: GET_VAR ': java.lang.Class<*> declared in .' type=java.lang.Class<*> origin=null diff --git a/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.kt.txt b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.kt.txt index c70146ea178..f7bd626aaef 100644 --- a/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.kt.txt +++ b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.kt.txt @@ -1,4 +1,4 @@ -val Class<*>.test: @FlexibleNullability Array? - get(): @FlexibleNullability Array? { +val Class<*>.test: @FlexibleNullability @FlexibleArrayElementVariance Array? + get(): @FlexibleNullability @FlexibleArrayElementVariance Array? { return .getDeclaredFields() } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.ir.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.ir.txt index c1e3d724a9b..9b3df58cd22 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.ir.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.ir.txt @@ -57,7 +57,7 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt BLOCK type=kotlin.Unit origin=FOR_LOOP VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] CALL 'public final fun iterator (): kotlin.collections.Iterator declared in kotlin.Array' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=FOR_LOOP_ITERATOR - $this: CALL 'public open fun arrayOfNotNull (): @[EnhancedNullability] kotlin.Array.P> declared in .J' type=@[EnhancedNullability] kotlin.Array.P> origin=null + $this: CALL 'public open fun arrayOfNotNull (): @[EnhancedNullability] @[FlexibleArrayElementVariance] kotlin.Array.P> declared in .J' type=@[EnhancedNullability] @[FlexibleArrayElementVariance] kotlin.Array.P> origin=null $this: GET_VAR 'j: .J declared in .testForInArrayUnused' type=.J origin=null WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT @@ -93,7 +93,7 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt BLOCK type=kotlin.Unit origin=FOR_LOOP VAR FOR_LOOP_ITERATOR name:tmp_5 type:kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] CALL 'public final fun iterator (): kotlin.collections.Iterator declared in kotlin.Array' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=FOR_LOOP_ITERATOR - $this: CALL 'public open fun arrayOfNotNull (): @[EnhancedNullability] kotlin.Array.P> declared in .J' type=@[EnhancedNullability] kotlin.Array.P> origin=null + $this: CALL 'public open fun arrayOfNotNull (): @[EnhancedNullability] @[FlexibleArrayElementVariance] kotlin.Array.P> declared in .J' type=@[EnhancedNullability] @[FlexibleArrayElementVariance] kotlin.Array.P> origin=null $this: GET_VAR 'j: .J declared in .testForInArrayUse' type=.J origin=null WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java index 3cd4ae71bc2..9a08f77011f 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java @@ -30675,6 +30675,36 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @Test + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @Test + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @Test @TestMetadata("protectedField.kt") public void testProtectedField() 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 8765a04393c..8a0e4dd7747 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 @@ -28965,6 +28965,36 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @Test + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @Test + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @Test @TestMetadata("protectedField.kt") public void testProtectedField() throws Exception { 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 5bf1f757eff..a6a37700439 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 @@ -30675,6 +30675,36 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @Test + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @Test + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @Test @TestMetadata("protectedField.kt") public void testProtectedField() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index 7f6d3d93628..85107bb9dc1 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -30675,6 +30675,36 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @Test + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @Test + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @Test + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @Test + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @Test @TestMetadata("protectedField.kt") public void testProtectedField() throws Exception { diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrMangledNameAndSignatureDumpHandler.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrMangledNameAndSignatureDumpHandler.kt index 0637bb8475e..70f77b0e1ad 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrMangledNameAndSignatureDumpHandler.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrMangledNameAndSignatureDumpHandler.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.test.backend.handlers import com.intellij.rt.execution.junit.FileComparisonFailure -import org.jetbrains.kotlin.ir.util.parents import org.jetbrains.kotlin.backend.common.serialization.signature.PublicIdSignatureComputer import org.jetbrains.kotlin.backend.jvm.JvmSymbols import org.jetbrains.kotlin.backend.jvm.ir.hasPlatformDependent @@ -349,6 +348,7 @@ private val EXCLUDED_ANNOTATIONS = setOf( StandardNames.FqNames.parameterName, JvmSymbols.FLEXIBLE_MUTABILITY_ANNOTATION_FQ_NAME, JvmSymbols.FLEXIBLE_NULLABILITY_ANNOTATION_FQ_NAME, + JvmSymbols.FLEXIBLE_VARIANCE_ANNOTATION_FQ_NAME, JvmSymbols.RAW_TYPE_ANNOTATION_FQ_NAME, StandardClassIds.Annotations.ContextFunctionTypeParams.asSingleFqName(), JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION, diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index d2ca6d75c3e..c4dc68c7f71 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -25961,6 +25961,31 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt"); } + @TestMetadata("overrideWithArrayParameterType.kt") + public void testOverrideWithArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt"); + } + + @TestMetadata("overrideWithArrayParameterType2.kt") + public void testOverrideWithArrayParameterType2() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt"); + } + + @TestMetadata("overrideWithArrayParameterTypeNotNull.kt") + public void testOverrideWithArrayParameterTypeNotNull() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt"); + } + + @TestMetadata("overrideWithGenericArrayParameterType.kt") + public void testOverrideWithGenericArrayParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt"); + } + + @TestMetadata("overrideWithVarargParameterType.kt") + public void testOverrideWithVarargParameterType() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt"); + } + @TestMetadata("protectedField.kt") public void testProtectedField() throws Exception { runTest("compiler/testData/codegen/box/javaInterop/protectedField.kt"); diff --git a/core/compiler.common/src/org/jetbrains/kotlin/name/StandardClassIds.kt b/core/compiler.common/src/org/jetbrains/kotlin/name/StandardClassIds.kt index d1b1b104365..0c0b9e4605b 100644 --- a/core/compiler.common/src/org/jetbrains/kotlin/name/StandardClassIds.kt +++ b/core/compiler.common/src/org/jetbrains/kotlin/name/StandardClassIds.kt @@ -175,6 +175,7 @@ object StandardClassIds { val RawTypeAnnotation = "RawType".internalIrId() val FlexibleNullability = "FlexibleNullability".internalIrId() val FlexibleMutability = "FlexibleMutability".internalIrId() + val FlexibleArrayElementVariance = "FlexibleArrayElementVariance".internalIrId() val EnhancedNullability = "EnhancedNullability".jvmInternalId() val FunctionN = "FunctionN".jvmFunctionsId() diff --git a/plugins/fir-plugin-prototype/testData/box/classWithAllPropertiesConstructor.fir.ir.txt b/plugins/fir-plugin-prototype/testData/box/classWithAllPropertiesConstructor.fir.ir.txt index c679309eb8a..02c1d26b659 100644 --- a/plugins/fir-plugin-prototype/testData/box/classWithAllPropertiesConstructor.fir.ir.txt +++ b/plugins/fir-plugin-prototype/testData/box/classWithAllPropertiesConstructor.fir.ir.txt @@ -227,7 +227,7 @@ FILE fqName: fileName:/main.kt VAR name:derived type:@[FlexibleNullability] .Derived? [val] CALL 'public open fun newInstance (vararg p0: @[FlexibleNullability] kotlin.Any?): @[FlexibleNullability] T of java.lang.reflect.Constructor? declared in java.lang.reflect.Constructor' type=@[FlexibleNullability] .Derived? origin=null $this: GET_VAR 'val constructor: java.lang.reflect.Constructor<.Derived> declared in .box' type=java.lang.reflect.Constructor<.Derived> origin=null - p0: VARARG type=@[FlexibleNullability] kotlin.Array? varargElementType=@[FlexibleNullability] kotlin.Any? + p0: VARARG type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? varargElementType=@[FlexibleNullability] kotlin.Any? CONSTRUCTOR_CALL 'public constructor (s: kotlin.String) declared in .A' type=.A origin=null s: CONST String type=kotlin.String value="a" CONSTRUCTOR_CALL 'public constructor (s: kotlin.String) declared in .B' type=.B origin=null