[FE 1.0] Return to the old type intersection emptiness check
This reverts commit 8227c4b603.
#KT-53656 Fixed
This commit is contained in:
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.isCaptured
|
||||
import org.jetbrains.kotlin.resolve.checkers.EmptyIntersectionTypeChecker
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.*
|
||||
@@ -31,7 +30,6 @@ import org.jetbrains.kotlin.types.model.TypeArgumentMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeVariableTypeConstructorMarker
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import org.jetbrains.kotlin.types.error.ErrorUtils
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@@ -397,8 +395,3 @@ fun isUnresolvedType(type: KotlinType): Boolean {
|
||||
}
|
||||
return type is ErrorType && type.kind.isUnresolved
|
||||
}
|
||||
|
||||
fun isEmptyIntersectionTypeCompatible(vararg types: KotlinTypeMarker): Boolean =
|
||||
EmptyIntersectionTypeChecker.computeEmptyIntersectionEmptiness(
|
||||
SimpleClassicTypeSystemContext, types.toList(), compatibilityModeEnabled = true
|
||||
)?.kind == EmptyIntersectionTypeKind.COMPATIBLE
|
||||
|
||||
+2
-15
@@ -425,10 +425,11 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
||||
return when (this) {
|
||||
is SimpleTypeMarker -> this.withNullability(nullable)
|
||||
is FlexibleTypeMarker -> createFlexibleType(lowerBound().withNullability(nullable), upperBound().withNullability(nullable))
|
||||
else -> asSimpleType()?.withNullability(nullable) ?: error("Unwrapped type should be simple")
|
||||
else -> error("sealed")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun newTypeCheckerState(
|
||||
errorTypesEqualToAnything: Boolean,
|
||||
stubTypesEqualToAnything: Boolean
|
||||
@@ -477,20 +478,6 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
||||
return this.replaceAnnotations(Annotations.create(annotationsWithoutExact))
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.canHaveSubtypes(typeChecker: AbstractTypeChecker): Boolean? {
|
||||
require(this is KotlinType, this::errorMessage)
|
||||
|
||||
val kotlinTypeChecker = object : KotlinTypeChecker {
|
||||
override fun isSubtypeOf(subtype: KotlinType, supertype: KotlinType): Boolean =
|
||||
typeChecker.isSubtypeOf(this@ClassicTypeSystemContext, subtype, supertype)
|
||||
|
||||
override fun equalTypes(a: KotlinType, b: KotlinType): Boolean =
|
||||
typeChecker.equalTypes(this@ClassicTypeSystemContext, a, b)
|
||||
}
|
||||
|
||||
return TypeUtils.canHaveSubtypes(kotlinTypeChecker, this)
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.hasExactAnnotation(): Boolean {
|
||||
require(this is UnwrappedType, this::errorMessage)
|
||||
return hasExactInternal(this)
|
||||
|
||||
Reference in New Issue
Block a user