Fix KotlinTypeCheckerTest in accordance with NI intersections

This commit is contained in:
Mikhail Glukhikh
2022-07-28 08:54:04 +02:00
committed by teamcity
parent 0198eeeafe
commit 3cb4b8ddda
3 changed files with 62 additions and 33 deletions
@@ -28,8 +28,10 @@ import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl;
import org.jetbrains.kotlin.psi.KtExpression;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.psi.KtPsiFactoryKt;
import org.jetbrains.kotlin.psi.KtTypeReference;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingTraceContext;
import org.jetbrains.kotlin.resolve.TypeResolutionContext;
import org.jetbrains.kotlin.resolve.TypeResolver;
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory;
@@ -174,7 +176,7 @@ public class KotlinTypeCheckerTest extends KotlinTestWithEnvironment {
assertCommonSupertype("Derived_T<Int>", "DDerived_T<Int>", "Derived_T<Int>");
assertCommonSupertype("Derived_T<Int>", "DDerived_T<Int>", "DDerived1_T<Int>");
assertCommonSupertype("Comparable<*>", "Comparable<Int>", "Comparable<Boolean>");
assertCommonSupertype("Comparable<Boolean & Int>", "Comparable<Int>", "Comparable<Boolean>");
assertCommonSupertype("Base_T<out I>", "Base_T<AI>", "Base_T<BI>");
assertCommonSupertype("Base_T<in Int>", "Base_T<Int>", "Base_T<in Int>");
assertCommonSupertype("Base_T<in Int>", "Derived_T<Int>", "Base_T<in Int>");
@@ -585,6 +587,7 @@ public class KotlinTypeCheckerTest extends KotlinTestWithEnvironment {
}
private KotlinType makeType(LexicalScope scope, String typeStr) {
return typeResolver.resolveType(scope, KtPsiFactoryKt.KtPsiFactory(getProject()).createType(typeStr), DummyTraces.DUMMY_TRACE, true);
KtTypeReference typeReference = KtPsiFactoryKt.KtPsiFactory(getProject()).createType(typeStr);
return typeResolver.resolveTypeWithPossibleIntersections(scope, typeReference, DummyTraces.DUMMY_TRACE);
}
}