[FIR] Rename ConeClassErrorType to ConeErrorType, drop ConeKotlinErrorType alias
This commit is contained in:
committed by
teamcity
parent
9c6292db6f
commit
0bd3e8f418
@@ -42,7 +42,7 @@ inline fun FirFunctionCall.copyAsImplicitInvokeCall(
|
||||
fun FirTypeRef.resolvedTypeFromPrototype(
|
||||
type: ConeKotlinType
|
||||
): FirResolvedTypeRef {
|
||||
return if (type is ConeKotlinErrorType) {
|
||||
return if (type is ConeErrorType) {
|
||||
buildErrorTypeRef {
|
||||
source = this@resolvedTypeFromPrototype.source
|
||||
this.type = type
|
||||
|
||||
@@ -58,7 +58,7 @@ fun ConeKotlinType.scope(
|
||||
|
||||
private fun ConeKotlinType.scope(useSiteSession: FirSession, scopeSession: ScopeSession, requiredPhase: FirResolvePhase): FirTypeScope? {
|
||||
return when (this) {
|
||||
is ConeKotlinErrorType -> null
|
||||
is ConeErrorType -> null
|
||||
is ConeClassLikeType -> {
|
||||
val fullyExpandedType = fullyExpandedType(useSiteSession)
|
||||
val fir = fullyExpandedType.lookupTag.toSymbol(useSiteSession)?.fir as? FirClass ?: return null
|
||||
|
||||
@@ -191,7 +191,7 @@ private fun FirClassifierSymbol<*>.collectSuperTypes(
|
||||
list += superClassTypes
|
||||
if (deep)
|
||||
superClassTypes.forEach {
|
||||
if (it !is ConeClassErrorType) {
|
||||
if (it !is ConeErrorType) {
|
||||
if (substituteSuperTypes) {
|
||||
val substitutedTypes = SmartList<ConeClassLikeType>()
|
||||
it.lookupTag.toSymbol(useSiteSession)?.collectSuperTypes(
|
||||
@@ -234,7 +234,7 @@ private fun FirClassifierSymbol<*>.collectSuperTypes(
|
||||
private fun ConeClassLikeType?.isClassBasedType(
|
||||
useSiteSession: FirSession
|
||||
): Boolean {
|
||||
if (this is ConeClassErrorType) return false
|
||||
if (this is ConeErrorType) return false
|
||||
val symbol = this?.lookupTag?.toSymbol(useSiteSession) as? FirClassSymbol ?: return false
|
||||
return when (symbol) {
|
||||
is FirAnonymousObjectSymbol -> true
|
||||
@@ -245,7 +245,7 @@ private fun ConeClassLikeType?.isClassBasedType(
|
||||
fun createSubstitutionForSupertype(superType: ConeLookupTagBasedType, session: FirSession): ConeSubstitutor {
|
||||
val klass = superType.lookupTag.toSymbol(session)?.fir as? FirRegularClass ?: return ConeSubstitutor.Empty
|
||||
val arguments = superType.typeArguments.map {
|
||||
it as? ConeKotlinType ?: ConeClassErrorType(ConeSimpleDiagnostic("illegal projection usage", DiagnosticKind.IllegalProjectionUsage))
|
||||
it as? ConeKotlinType ?: ConeErrorType(ConeSimpleDiagnostic("illegal projection usage", DiagnosticKind.IllegalProjectionUsage))
|
||||
}
|
||||
val mapping = klass.typeParameters.map { it.symbol }.zip(arguments).toMap()
|
||||
return ConeSubstitutorByMap(mapping, session)
|
||||
|
||||
@@ -129,7 +129,7 @@ private fun mapTypeAliasArguments(
|
||||
val mappedProjection = typeAliasMap[symbol] ?: return super.substituteArgument(projection, lookupTag, index)
|
||||
var mappedType = (mappedProjection as? ConeKotlinTypeProjection)?.type.updateNullabilityIfNeeded(type)
|
||||
mappedType = when (mappedType) {
|
||||
is ConeClassErrorType,
|
||||
is ConeErrorType,
|
||||
is ConeClassLikeTypeImpl,
|
||||
is ConeDefinitelyNotNullType,
|
||||
is ConeTypeParameterTypeImpl,
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class AbstractExplicitReceiverValue<E : FirExpression> : AbstractExplic
|
||||
override val type: ConeKotlinType
|
||||
// NB: safe cast is necessary here
|
||||
get() = explicitReceiver.typeRef.coneTypeSafe()
|
||||
?: ConeKotlinErrorType(ConeIntermediateDiagnostic("No type calculated for: ${explicitReceiver.renderWithType()}")) // TODO: assert here
|
||||
?: ConeErrorType(ConeIntermediateDiagnostic("No type calculated for: ${explicitReceiver.renderWithType()}")) // TODO: assert here
|
||||
|
||||
override val receiverExpression: FirExpression
|
||||
get() = explicitReceiver
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ abstract class AbstractConeSubstitutor(protected val typeContext: ConeTypeContex
|
||||
|
||||
private fun ConeKotlinType.substituteRecursive(): ConeKotlinType? {
|
||||
return when (this) {
|
||||
is ConeClassErrorType -> return null
|
||||
is ConeErrorType -> return null
|
||||
is ConeClassLikeType -> this.substituteArguments()
|
||||
is ConeLookupTagBasedType -> return null
|
||||
is ConeFlexibleType -> this.substituteBounds()?.let {
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.fir.scopes.impl.*
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassErrorType
|
||||
import org.jetbrains.kotlin.fir.types.ConeErrorType
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
|
||||
@@ -124,7 +124,7 @@ fun ConeKotlinType.scopeForSupertype(
|
||||
subClass: FirClass,
|
||||
): FirTypeScope? {
|
||||
if (this !is ConeClassLikeType) return null
|
||||
if (this is ConeClassErrorType) return null
|
||||
if (this is ConeErrorType) return null
|
||||
val symbol = lookupTag.toSymbol(useSiteSession)
|
||||
return if (symbol is FirRegularClassSymbol) {
|
||||
symbol.fir.scopeForClassImpl(
|
||||
|
||||
@@ -362,12 +362,12 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
|
||||
return isContainedInInvariantOrContravariantPositions
|
||||
}
|
||||
|
||||
override fun createErrorType(debugName: String): ConeClassErrorType {
|
||||
return ConeClassErrorType(ConeIntermediateDiagnostic(debugName))
|
||||
override fun createErrorType(debugName: String): ConeErrorType {
|
||||
return ConeErrorType(ConeIntermediateDiagnostic(debugName))
|
||||
}
|
||||
|
||||
override fun createErrorTypeWithCustomConstructor(debugName: String, constructor: TypeConstructorMarker): KotlinTypeMarker {
|
||||
return ConeKotlinErrorType(ConeIntermediateDiagnostic("$debugName c: $constructor"))
|
||||
return ConeErrorType(ConeIntermediateDiagnostic("$debugName c: $constructor"))
|
||||
}
|
||||
|
||||
override fun CapturedTypeMarker.captureStatus(): CaptureStatus {
|
||||
|
||||
@@ -89,13 +89,13 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
|
||||
override fun KotlinTypeMarker.isError(): Boolean {
|
||||
assert(this is ConeKotlinType)
|
||||
return this is ConeClassErrorType || this is ConeKotlinErrorType || this.typeConstructor().isError() ||
|
||||
return this is ConeErrorType || this is ConeErrorType || this.typeConstructor().isError() ||
|
||||
(this is ConeClassLikeType && this.lookupTag is ConeClassLikeErrorLookupTag)
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.isUninferredParameter(): Boolean {
|
||||
assert(this is ConeKotlinType)
|
||||
return this is ConeClassErrorType && this.isUninferredParameter
|
||||
return this is ConeErrorType && this.isUninferredParameter
|
||||
}
|
||||
|
||||
override fun FlexibleTypeMarker.asDynamicType(): DynamicTypeMarker? {
|
||||
|
||||
@@ -96,7 +96,7 @@ fun <T : ConeKotlinType> T.withArguments(arguments: Array<out ConeTypeProjection
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return when (this) {
|
||||
is ConeClassErrorType -> this
|
||||
is ConeErrorType -> this
|
||||
is ConeClassLikeTypeImpl -> ConeClassLikeTypeImpl(lookupTag, arguments, nullability.isNullable) as T
|
||||
is ConeDefinitelyNotNullType -> ConeDefinitelyNotNullType(original.withArguments(arguments)) as T
|
||||
else -> error("Not supported: $this: ${this.render()}")
|
||||
@@ -113,7 +113,7 @@ fun <T : ConeKotlinType> T.withAttributes(attributes: ConeAttributes): T {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return when (this) {
|
||||
is ConeClassErrorType -> this
|
||||
is ConeErrorType -> this
|
||||
is ConeClassLikeTypeImpl -> ConeClassLikeTypeImpl(lookupTag, typeArguments, nullability.isNullable, attributes)
|
||||
is ConeDefinitelyNotNullType -> ConeDefinitelyNotNullType(original.withAttributes(attributes))
|
||||
is ConeTypeParameterTypeImpl -> ConeTypeParameterTypeImpl(lookupTag, nullability.isNullable, attributes)
|
||||
@@ -143,7 +143,7 @@ fun <T : ConeKotlinType> T.withNullability(
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return when (this) {
|
||||
is ConeClassErrorType -> this
|
||||
is ConeErrorType -> this
|
||||
is ConeClassLikeTypeImpl -> ConeClassLikeTypeImpl(lookupTag, typeArguments, nullability.isNullable, attributes)
|
||||
is ConeTypeParameterTypeImpl -> ConeTypeParameterTypeImpl(lookupTag, nullability.isNullable, attributes)
|
||||
is ConeFlexibleType -> {
|
||||
@@ -223,7 +223,7 @@ fun ConeKotlinType.toFirResolvedTypeRef(
|
||||
source: KtSourceElement? = null,
|
||||
delegatedTypeRef: FirTypeRef? = null
|
||||
): FirResolvedTypeRef {
|
||||
return if (this is ConeKotlinErrorType) {
|
||||
return if (this is ConeErrorType) {
|
||||
buildErrorTypeRef {
|
||||
this.source = source
|
||||
diagnostic = this@toFirResolvedTypeRef.diagnostic
|
||||
@@ -282,7 +282,7 @@ fun FirTypeRef.withReplacedConeType(
|
||||
else
|
||||
this.source
|
||||
|
||||
return if (newType is ConeKotlinErrorType) {
|
||||
return if (newType is ConeErrorType) {
|
||||
buildErrorTypeRef {
|
||||
source = newSource
|
||||
type = newType
|
||||
|
||||
Reference in New Issue
Block a user