diff --git a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt index 27d2206a21e..d5b64793ad4 100644 --- a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt +++ b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt @@ -71,6 +71,8 @@ sealed class ConeKotlinType : ConeKotlinTypeProjection(), } } +sealed class ConeSimpleKotlinType : ConeKotlinType(), SimpleTypeMarker + interface ConeTypedProjection { val type: ConeKotlinType } @@ -94,7 +96,7 @@ class ConeClassErrorType(val reason: String) : ConeClassLikeType() { } } -abstract class ConeLookupTagBasedType : ConeKotlinType(), SimpleTypeMarker { +abstract class ConeLookupTagBasedType : ConeSimpleKotlinType() { abstract val lookupTag: ConeClassifierLookupTag } @@ -150,7 +152,7 @@ class ConeCapturedType( val lowerType: ConeKotlinType?, override val nullability: ConeNullability = ConeNullability.NOT_NULL, val constructor: ConeCapturedTypeConstructor -) : ConeKotlinType(), SimpleTypeMarker, CapturedTypeMarker { +) : ConeSimpleKotlinType(), CapturedTypeMarker { constructor(captureStatus: CaptureStatus, lowerType: ConeKotlinType?, projection: ConeKotlinTypeProjection) : this( captureStatus, lowerType, @@ -170,7 +172,7 @@ class ConeTypeVariableType( override val typeArguments: Array get() = emptyArray() } -class ConeDefinitelyNotNullType private constructor(val original: ConeKotlinType) : ConeKotlinType(), DefinitelyNotNullTypeMarker { +class ConeDefinitelyNotNullType private constructor(val original: ConeKotlinType) : ConeSimpleKotlinType(), DefinitelyNotNullTypeMarker { override val typeArguments: Array get() = original.typeArguments override val nullability: ConeNullability @@ -194,7 +196,7 @@ class ConeRawType(lowerBound: ConeKotlinType, upperBound: ConeKotlinType) : Cone */ class ConeIntersectionType( val intersectedTypes: Collection -) : ConeKotlinType(), SimpleTypeMarker, TypeConstructorMarker { +) : ConeSimpleKotlinType(), TypeConstructorMarker { override val typeArguments: Array get() = emptyArray() @@ -206,7 +208,7 @@ fun ConeIntersectionType.mapTypes(func: (ConeKotlinType) -> ConeKotlinType): Con return ConeIntersectionType(intersectedTypes.map(func)) } -class ConeStubType(val variable: ConeTypeVariable, override val nullability: ConeNullability) : StubTypeMarker, ConeKotlinType() { +class ConeStubType(val variable: ConeTypeVariable, override val nullability: ConeNullability) : StubTypeMarker, ConeSimpleKotlinType() { override val typeArguments: Array get() = emptyArray() } @@ -220,7 +222,7 @@ class ConeTypeVariableTypeConstructor(val debugName: String) : ConeClassifierLoo override val name: Name get() = Name.identifier(debugName) } -abstract class ConeIntegerLiteralType(val value: Long) : ConeKotlinType(), SimpleTypeMarker, TypeConstructorMarker { +abstract class ConeIntegerLiteralType(val value: Long) : ConeSimpleKotlinType(), TypeConstructorMarker { abstract val possibleTypes: Collection abstract val supertypes: List diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt index 13c1c324e04..a4cb358729f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.firUnsafe import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol +import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.symbols.invoke @@ -62,13 +63,8 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty assert(this is ConeKotlinType) return when (this) { is ConeClassLikeType -> fullyExpandedType(session) - is ConeCapturedType -> this - is ConeLookupTagBasedType -> this - is ConeDefinitelyNotNullType -> this - is ConeIntersectionType -> this + is ConeSimpleKotlinType -> this is ConeFlexibleType -> null - is ConeStubType -> this - is ConeIntegerLiteralType -> this else -> error("Unknown simpleType: $this") } }