[FE 1.0] Use the old type intersection for type parameter bounds

This is a partial revert of commit bc1c2ada
We have to use old type intersector for emptiness check because
KT-53656 were found. We return to old type intersector usage also
for type parameter bounds to prevent other possible problems.
This commit is contained in:
Mikhail Glukhikh
2022-09-06 11:47:06 +02:00
committed by Space
parent 3bdd52b64a
commit c1b0405c4e
3 changed files with 5 additions and 9 deletions
@@ -31,7 +31,6 @@ 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;
@@ -46,7 +45,6 @@ import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment;
import org.jetbrains.kotlin.tests.di.ContainerForTests;
import org.jetbrains.kotlin.tests.di.InjectionKt;
import org.jetbrains.kotlin.types.checker.IntersectionTypeKt;
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices;
@@ -176,7 +174,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<Boolean & Int>", "Comparable<Int>", "Comparable<Boolean>");
assertCommonSupertype("Comparable<*>", "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>");
@@ -508,7 +506,7 @@ public class KotlinTypeCheckerTest extends KotlinTestWithEnvironment {
for (String type : types) {
typesToIntersect.add(makeType(type));
}
KotlinType result = IntersectionTypeKt.intersectWrappedTypes(typesToIntersect);
KotlinType result = TypeIntersector.intersectTypes(typesToIntersect);
// assertNotNull("Intersection is null for " + typesToIntersect, result);
assertEquals(makeType(expected), result);
}