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 1830877d9dc..992756eef13 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 @@ -105,9 +105,10 @@ class Fir2IrTypeConverter( if (annotations.any { it.classId == attributeAnnotation.classId }) continue typeAnnotations += callGenerator.convertToIrConstructorCall(attributeAnnotation) as? IrConstructorCall ?: continue } + val expandedType = fullyExpandedType(session) IrSimpleTypeImpl( - irSymbol, !typeContext.definitelyNotNull && this.isMarkedNullable, - fullyExpandedType(session).typeArguments.map { it.toIrTypeArgument(typeContext) }, + irSymbol, !typeContext.definitelyNotNull && expandedType.isMarkedNullable, + expandedType.typeArguments.map { it.toIrTypeArgument(typeContext) }, typeAnnotations ) } 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 5717b5cacbb..b4bf69ddaf2 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 @@ -14846,6 +14846,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test + @TestMetadata("ClassBuilder.kt") + public void testClassBuilder() throws Exception { + runTest("compiler/testData/codegen/box/fir/ClassBuilder.kt"); + } + @Test @TestMetadata("ConstValAccess.kt") public void testConstValAccess() throws Exception { diff --git a/compiler/testData/codegen/box/fir/ClassBuilder.kt b/compiler/testData/codegen/box/fir/ClassBuilder.kt new file mode 100644 index 00000000000..04201081d9a --- /dev/null +++ b/compiler/testData/codegen/box/fir/ClassBuilder.kt @@ -0,0 +1,26 @@ +// TARGET_BACKEND: JVM + +// FILE: ClassBuilder.java + +import org.jetbrains.annotations.Nullable; + +public interface ClassBuilder { + void newMethod(@Nullable String[] exceptions); +} + +// FILE: test.kt + +typealias JvmMethodExceptionTypes = Array? + +class TestClassBuilder : ClassBuilder { + override fun newMethod(exceptions: JvmMethodExceptionTypes) { + + } +} + +fun box(): String { + val arr = arrayOf("OK") + TestClassBuilder().newMethod(null) + TestClassBuilder().newMethod(arr) + return arr[0] +} \ No newline at end of file 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 6b2921c3420..e22a1d45533 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 @@ -14846,6 +14846,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @Test + @TestMetadata("ClassBuilder.kt") + public void testClassBuilder() throws Exception { + runTest("compiler/testData/codegen/box/fir/ClassBuilder.kt"); + } + @Test @TestMetadata("ConstValAccess.kt") public void testConstValAccess() 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 c7dd2e03258..670868564e0 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 @@ -14846,6 +14846,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test + @TestMetadata("ClassBuilder.kt") + public void testClassBuilder() throws Exception { + runTest("compiler/testData/codegen/box/fir/ClassBuilder.kt"); + } + @Test @TestMetadata("ConstValAccess.kt") public void testConstValAccess() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 6de3b5de938..6c8a248169c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -12278,6 +12278,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @TestMetadata("ClassBuilder.kt") + public void testClassBuilder() throws Exception { + runTest("compiler/testData/codegen/box/fir/ClassBuilder.kt"); + } + @TestMetadata("ConstValAccess.kt") public void testConstValAccess() throws Exception { runTest("compiler/testData/codegen/box/fir/ConstValAccess.kt");