diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 6978d0f060db9..c7b954d85b452 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -14356,6 +14356,11 @@ public void testLambdaInstanceOf() throws Exception { runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt"); } + @TestMetadata("samUnboundTypeParameter.kt") + public void testSamUnboundTypeParameter() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt"); + } + @TestMetadata("compiler/testData/codegen/box/javaInterop/generics") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt index 2de91041e7400..4074386d3fb8b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt @@ -120,6 +120,8 @@ class DeclarationStubGenerator( generatePropertyStub(descriptor) is TypeAliasDescriptor -> generateTypeAliasStub(descriptor) + is TypeParameterDescriptor -> + generateOrGetTypeParameterStub(descriptor) else -> throw AssertionError("Unexpected member descriptor: $descriptor") } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ExternalDependenciesGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ExternalDependenciesGenerator.kt index 293b5eb9c98c4..26c792db6a539 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ExternalDependenciesGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ExternalDependenciesGenerator.kt @@ -65,6 +65,7 @@ private val SymbolTable.allUnbound: List r.addAll(unboundSimpleFunctions) r.addAll(unboundProperties) r.addAll(unboundTypeAliases) + r.addAll(unboundTypeParameters) return r } diff --git a/compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt b/compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt new file mode 100644 index 0000000000000..b57197333d0dc --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt @@ -0,0 +1,22 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND_FIR: JVM_IR +// !LANGUAGE: -NewInference +// WITH_RUNTIME +// FILE: Base.java +import java.lang.Runnable; +import java.lang.IllegalStateException; + +public class Base { + public S add(Base value, Runnable block) { return null; } +} + +// FILE: Derived.kt +class Derived(val value: T) : Base() { + init { + add(this) {} + } +} + +fun box(): String { + return Derived("OK").value +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 33241571d11e8..f93caa8d809f4 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -15571,6 +15571,11 @@ public void testLambdaInstanceOf() throws Exception { runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt"); } + @TestMetadata("samUnboundTypeParameter.kt") + public void testSamUnboundTypeParameter() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt"); + } + @TestMetadata("compiler/testData/codegen/box/javaInterop/generics") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index adbac04e30e4b..e6c1b9f98c98d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -15571,6 +15571,11 @@ public void testLambdaInstanceOf() throws Exception { runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt"); } + @TestMetadata("samUnboundTypeParameter.kt") + public void testSamUnboundTypeParameter() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt"); + } + @TestMetadata("compiler/testData/codegen/box/javaInterop/generics") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index a68e4f13ebb06..40bce6a71b738 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -14356,6 +14356,11 @@ public void testLambdaInstanceOf() throws Exception { runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt"); } + @TestMetadata("samUnboundTypeParameter.kt") + public void testSamUnboundTypeParameter() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt"); + } + @TestMetadata("compiler/testData/codegen/box/javaInterop/generics") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)