diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeInferenceContext.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeInferenceContext.kt index 71aa02373ca..db6b7280d6a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeInferenceContext.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeInferenceContext.kt @@ -241,7 +241,7 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, override fun KotlinTypeMarker.mayBeTypeVariable(): Boolean { require(this is ConeKotlinType) - return this is ConeTypeVariableType + return this.typeConstructor() is ConeTypeVariableTypeConstructor } override fun CapturedTypeMarker.typeConstructorProjection(): TypeArgumentMarker { diff --git a/compiler/fir/resolve/testData/resolve/stdlib/j+k/typeParameterUse.kt b/compiler/fir/resolve/testData/resolve/stdlib/j+k/typeParameterUse.kt new file mode 100644 index 00000000000..16dbfa26eed --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/stdlib/j+k/typeParameterUse.kt @@ -0,0 +1,19 @@ +// FULL_JDK +// FILE: U.java +import org.jetbrains.annotations.NotNull; +public class U { + + @NotNull + public T getValue(Box<@NotNull T> box) {} +} + +// FILE: Box.java + +public class Box {} + + +// FILE: useSite.kt +fun foo(holder: U, box: Box): Int { + + return holder.getValue(box) +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/stdlib/j+k/typeParameterUse.txt b/compiler/fir/resolve/testData/resolve/stdlib/j+k/typeParameterUse.txt new file mode 100644 index 00000000000..e4f74861b68 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/stdlib/j+k/typeParameterUse.txt @@ -0,0 +1,4 @@ +FILE: useSite.kt + public final fun foo(holder: R|U|, box: R|Box|): R|kotlin/Int| { + ^foo R|/holder|.R|/U.getValue|(R|/box|) + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java index 40393eaaefb..667b1f5ebd4 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java @@ -513,6 +513,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic public void testStaticGenericMethod() throws Exception { runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/StaticGenericMethod.kt"); } + + @TestMetadata("typeParameterUse.kt") + public void testTypeParameterUse() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/typeParameterUse.kt"); + } } @TestMetadata("compiler/fir/resolve/testData/resolve/stdlib/problems")