[NI] Get rid of FE 1.0 types in AbstractTypeApproximator
This commit is contained in:
@@ -28,6 +28,8 @@ interface TypeVariableTypeConstructorMarker : TypeConstructorMarker
|
||||
|
||||
interface CapturedTypeConstructorMarker : TypeConstructorMarker
|
||||
|
||||
interface IntersectionTypeConstructorMarker : TypeConstructorMarker
|
||||
|
||||
interface TypeSubstitutorMarker
|
||||
|
||||
|
||||
@@ -174,8 +176,12 @@ interface TypeSystemInferenceExtensionContext : TypeSystemContext, TypeSystemBui
|
||||
secondCandidate: KotlinTypeMarker
|
||||
): KotlinTypeMarker
|
||||
|
||||
fun KotlinTypeMarker.isSpecial(): Boolean
|
||||
|
||||
fun TypeConstructorMarker.isTypeVariable(): Boolean
|
||||
fun TypeVariableTypeConstructorMarker.isContainedInInvariantOrContravariantPositions(): Boolean
|
||||
|
||||
fun KotlinTypeMarker.isSignedOrUnsignedNumberType(): Boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -202,6 +208,9 @@ interface TypeSystemContext : TypeSystemOptimizationContext {
|
||||
|
||||
fun SimpleTypeMarker.asDefinitelyNotNullType(): DefinitelyNotNullTypeMarker?
|
||||
fun SimpleTypeMarker.isMarkedNullable(): Boolean
|
||||
fun KotlinTypeMarker.isMarkedNullable(): Boolean =
|
||||
this is SimpleTypeMarker && isMarkedNullable()
|
||||
|
||||
fun SimpleTypeMarker.withNullability(nullable: Boolean): SimpleTypeMarker
|
||||
fun SimpleTypeMarker.typeConstructor(): TypeConstructorMarker
|
||||
|
||||
@@ -323,7 +332,7 @@ interface TypeSystemContext : TypeSystemOptimizationContext {
|
||||
fun intersectTypes(types: List<KotlinTypeMarker>): KotlinTypeMarker
|
||||
fun intersectTypes(types: List<SimpleTypeMarker>): SimpleTypeMarker
|
||||
|
||||
fun KotlinTypeMarker.isSimpleType() = asSimpleType() != null
|
||||
fun KotlinTypeMarker.isSimpleType(): Boolean = asSimpleType() != null
|
||||
|
||||
fun prepareType(type: KotlinTypeMarker): KotlinTypeMarker
|
||||
|
||||
|
||||
@@ -23,10 +23,11 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.TypeIntersectionScope
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
|
||||
import org.jetbrains.kotlin.types.model.IntersectionTypeConstructorMarker
|
||||
import org.jetbrains.kotlin.types.refinement.TypeRefinement
|
||||
import java.util.*
|
||||
|
||||
class IntersectionTypeConstructor(typesToIntersect: Collection<KotlinType>) : TypeConstructor {
|
||||
class IntersectionTypeConstructor(typesToIntersect: Collection<KotlinType>) : TypeConstructor, IntersectionTypeConstructorMarker {
|
||||
private var alternative: KotlinType? = null
|
||||
|
||||
private constructor(
|
||||
|
||||
@@ -36,9 +36,6 @@ interface TypeSystemCommonBackendContext : TypeSystemContext {
|
||||
fun TypeParameterMarker.getRepresentativeUpperBound(): KotlinTypeMarker
|
||||
fun KotlinTypeMarker.getSubstitutedUnderlyingType(): KotlinTypeMarker?
|
||||
|
||||
fun KotlinTypeMarker.isMarkedNullable(): Boolean =
|
||||
this is SimpleTypeMarker && isMarkedNullable()
|
||||
|
||||
fun KotlinTypeMarker.makeNullable(): KotlinTypeMarker =
|
||||
asSimpleType()?.withNullability(true) ?: this
|
||||
|
||||
|
||||
+12
-1
@@ -6,8 +6,8 @@
|
||||
package org.jetbrains.kotlin.types.checker
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.StandardNames.FqNames
|
||||
import org.jetbrains.kotlin.builtins.PrimitiveType
|
||||
import org.jetbrains.kotlin.builtins.StandardNames.FqNames
|
||||
import org.jetbrains.kotlin.builtins.isBuiltinFunctionalTypeOrSubtype
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
import org.jetbrains.kotlin.types.typeUtil.isSignedOrUnsignedNumberType as classicIsSignedOrUnsignedNumberType
|
||||
|
||||
interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSystemCommonBackendContext {
|
||||
override fun TypeConstructorMarker.isDenotable(): Boolean {
|
||||
@@ -517,6 +518,11 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
||||
errorSupportedOnlyInTypeInference()
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.isSpecial(): Boolean {
|
||||
require(this is KotlinType)
|
||||
return this is TypeUtils.SpecialType
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.isTypeVariable(): Boolean {
|
||||
errorSupportedOnlyInTypeInference()
|
||||
}
|
||||
@@ -525,6 +531,11 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
||||
errorSupportedOnlyInTypeInference()
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.isSignedOrUnsignedNumberType(): Boolean {
|
||||
require(this is KotlinType)
|
||||
return classicIsSignedOrUnsignedNumberType()
|
||||
}
|
||||
|
||||
override fun findCommonIntegerLiteralTypesSuperType(explicitSupertypes: List<SimpleTypeMarker>): SimpleTypeMarker? {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
explicitSupertypes as List<SimpleType>
|
||||
|
||||
Reference in New Issue
Block a user