[FE 1.0] Use the new type intersection to intersect types

This commit is contained in:
Victor Petukhov
2022-06-09 09:48:25 +02:00
committed by teamcity
parent 941a33a184
commit bc1c2adae1
6 changed files with 20 additions and 20 deletions
@@ -20,9 +20,8 @@ import org.jetbrains.kotlin.builtins.DefaultBuiltIns
import org.jetbrains.kotlin.test.KotlinTestWithEnvironmentManagement
import org.jetbrains.kotlin.types.AbstractNullabilityChecker
import org.jetbrains.kotlin.types.KotlinTypeFactory
import org.jetbrains.kotlin.types.SimpleType
import org.jetbrains.kotlin.types.TypeIntersector
import org.jetbrains.kotlin.types.checker.createClassicTypeCheckerState
import org.jetbrains.kotlin.types.checker.intersectTypes
class SlowTypeAssertionsEnabledTest : KotlinTestWithEnvironmentManagement() {
@@ -43,10 +42,10 @@ class SlowTypeAssertionsEnabledTest : KotlinTestWithEnvironmentManagement() {
val builtIns = DefaultBuiltIns.Instance
try {
val superType = TypeIntersector.intersectTypes(listOf(builtIns.charSequence.defaultType, builtIns.comparable.defaultType))
val superType = intersectTypes(listOf(builtIns.charSequence.defaultType, builtIns.comparable.defaultType))
AbstractNullabilityChecker.isPossibleSubtype(
createClassicTypeCheckerState(isErrorTypeEqualsToAnything = true), builtIns.annotationType,
superType as SimpleType
superType
)
} catch (e: AssertionError) {
assertEquals("Not singleClassifierType superType: {CharSequence & Comparable<T>}", e.message)
@@ -44,6 +44,7 @@ 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;
@@ -505,7 +506,7 @@ public class KotlinTypeCheckerTest extends KotlinTestWithEnvironment {
for (String type : types) {
typesToIntersect.add(makeType(type));
}
KotlinType result = TypeIntersector.intersectTypes(typesToIntersect);
KotlinType result = IntersectionTypeKt.intersectWrappedTypes(typesToIntersect);
// assertNotNull("Intersection is null for " + typesToIntersect, result);
assertEquals(makeType(expected), result);
}