[FIR] Fix isMyTypeVariable in ConeInferenceContext

This commit is contained in:
Simon Ogorodnik
2019-11-19 19:16:25 +03:00
parent ffa0896592
commit d59a171b65
4 changed files with 29 additions and 1 deletions
@@ -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 {
@@ -0,0 +1,19 @@
// FULL_JDK
// FILE: U.java
import org.jetbrains.annotations.NotNull;
public class U {
@NotNull
public <T> T getValue(Box<@NotNull T> box) {}
}
// FILE: Box.java
public class Box<T> {}
// FILE: useSite.kt
fun foo(holder: U, box: Box<Int>): Int {
return holder.getValue(box)
}
@@ -0,0 +1,4 @@
FILE: useSite.kt
public final fun foo(holder: R|U|, box: R|Box<kotlin/Int>|): R|kotlin/Int| {
^foo R|<local>/holder|.R|/U.getValue|<R|kotlin/Int|>(R|<local>/box|)
}
@@ -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")