diff --git a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt index 637821f6eb6..bab7f1896a1 100644 --- a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt +++ b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt @@ -34,7 +34,6 @@ import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags import org.jetbrains.kotlin.serialization.deserialization.getClassId import org.jetbrains.kotlin.serialization.deserialization.getName import org.jetbrains.kotlin.types.Variance -import java.util.* class FirTypeDeserializer( val moduleData: FirModuleData, @@ -164,7 +163,7 @@ class FirTypeDeserializer( if (constructor is ConeTypeParameterLookupTag) { return ConeTypeParameterTypeImpl(constructor, isNullable = proto.nullable).let { if (Flags.DEFINITELY_NOT_NULL_TYPE.get(proto.flags)) - ConeDefinitelyNotNullType.create(it, moduleData.session.typeContext) ?: it + ConeDefinitelyNotNullType.create(it, moduleData.session.typeContext, avoidComprehensiveCheck = true) ?: it else it } 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 316a559a91d..82b1fe4da0a 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 @@ -7688,6 +7688,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); } + @Test + @TestMetadata("javaTypeParameterBy.kt") + public void testJavaTypeParameterBy() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/javaTypeParameterBy.kt"); + } + @Test @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() throws Exception { diff --git a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/javaTypeParameterBy.kt b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/javaTypeParameterBy.kt new file mode 100644 index 00000000000..eba02923b30 --- /dev/null +++ b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/javaTypeParameterBy.kt @@ -0,0 +1,24 @@ +// TARGET_BACKEND: JVM +// WITH_STDLIB +// MODULE: lib + +// FILE: JavaInterface.java +public interface JavaInterface { + > K foo(); +} + +// FILE: A.kt + +class A(j: JavaInterface) : JavaInterface by j + + +// MODULE: main(lib) +// FILE: main.kt + +fun box(): String { + val t = object : JavaInterface { + override fun > foo(): K = "OK" as K + } + + return A(t).foo() +} 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 266e7b2b95f..4be1d9bbb32 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 @@ -7544,6 +7544,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); } + @Test + @TestMetadata("javaTypeParameterBy.kt") + public void testJavaTypeParameterBy() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/javaTypeParameterBy.kt"); + } + @Test @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() 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 af4b618fbbf..8ee1ccf299c 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 @@ -7688,6 +7688,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); } + @Test + @TestMetadata("javaTypeParameterBy.kt") + public void testJavaTypeParameterBy() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/javaTypeParameterBy.kt"); + } + @Test @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxTestGenerated.java index d3301440865..ae78e1a72d2 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxTestGenerated.java @@ -520,6 +520,12 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); } + @Test + @TestMetadata("javaTypeParameterBy.kt") + public void testJavaTypeParameterBy() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/javaTypeParameterBy.kt"); + } + @Test @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxTestGenerated.java index 4411100d702..8fcbb052d4e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxTestGenerated.java @@ -514,6 +514,12 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); } + @Test + @TestMetadata("javaTypeParameterBy.kt") + public void testJavaTypeParameterBy() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/fir/javaTypeParameterBy.kt"); + } + @Test @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() throws Exception {