[FIR] Rename ConeClassErrorType to ConeErrorType, drop ConeKotlinErrorType alias

This commit is contained in:
Dmitriy Novozhilov
2022-01-28 14:37:03 +03:00
committed by teamcity
parent 9c6292db6f
commit 0bd3e8f418
77 changed files with 138 additions and 140 deletions
@@ -431,7 +431,7 @@ internal class KtSymbolByFirBuilder private constructor(
else KtFirUsualClassType(coneType, token, this@KtSymbolByFirBuilder)
}
is ConeTypeParameterType -> KtFirTypeParameterType(coneType, token, this@KtSymbolByFirBuilder)
is ConeClassErrorType -> KtFirClassErrorType(coneType, token, this@KtSymbolByFirBuilder)
is ConeErrorType -> KtFirClassErrorType(coneType, token, this@KtSymbolByFirBuilder)
is ConeFlexibleType -> KtFirFlexibleType(coneType, token, this@KtSymbolByFirBuilder)
is ConeIntersectionType -> KtFirIntersectionType(coneType, token, this@KtSymbolByFirBuilder)
is ConeDefinitelyNotNullType -> KtFirDefinitelyNotNullType(coneType, token, this@KtSymbolByFirBuilder)
@@ -179,9 +179,9 @@ internal fun ConeKotlinType.asPsiType(
): PsiType? {
val correctedType = simplifyType(session, useSitePosition)
if (correctedType is ConeClassErrorType || correctedType !is SimpleTypeMarker) return null
if (correctedType is ConeErrorType || correctedType !is SimpleTypeMarker) return null
if (correctedType.typeArguments.any { it is ConeClassErrorType }) return null
if (correctedType.typeArguments.any { it is ConeErrorType }) return null
val signatureWriter = BothSignatureWriter(BothSignatureWriter.Mode.SKIP_CHECKS)
@@ -355,7 +355,7 @@ private class ElementsToShortenCollector(
val ConeKotlinType.candidateClassId: ClassId?
get() {
return when (this) {
is ConeClassErrorType -> when (val diagnostic = this.diagnostic) {
is ConeErrorType -> when (val diagnostic = this.diagnostic) {
// Tolerate code that misses type parameters while shortening it.
is ConeUnmatchedTypeArgumentsError -> diagnostic.symbol.classId
else -> null
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedSymbolError
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
import org.jetbrains.kotlin.fir.scopes.impl.toConeType
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
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.typeContext
@@ -33,7 +33,7 @@ internal class KtFirTypeCreator(
val lookupTag = when (builder) {
is KtClassTypeBuilder.ByClassId -> {
val classSymbol = rootModuleSession.symbolProvider.getClassLikeSymbolByClassId(builder.classId)
?: return ConeClassErrorType(ConeUnresolvedSymbolError(builder.classId)).asKtType() as KtClassType
?: return ConeErrorType(ConeUnresolvedSymbolError(builder.classId)).asKtType() as KtClassType
classSymbol.toLookupTag()
}
is KtClassTypeBuilder.BySymbol -> {
@@ -139,7 +139,7 @@ internal class KtFirTypeProvider(
ConeDefinitelyNotNullType.create(it, analysisSession.rootModuleSession.typeContext) ?: it
}
is ConeIntersectionType -> intersectedTypes.asSequence().flatMap { it.getDirectSuperTypes(shouldApproximate) }
is ConeClassErrorType -> emptySequence()
is ConeErrorType -> emptySequence()
is ConeLookupTagBasedType -> getSubstitutedSuperTypes(shouldApproximate)
else -> emptySequence()
}.distinct()
@@ -164,7 +164,7 @@ internal object FirCompileTimeConstantEvaluator {
private fun ConeKotlinType.toConstantValueKind(): ConstantValueKind<*>? =
when (this) {
is ConeKotlinErrorType -> null
is ConeErrorType -> null
is ConeLookupTagBasedType -> lookupTag.name.asString().toConstantValueKind()
is ConeFlexibleType -> upperBound.toConstantValueKind()
is ConeCapturedType -> lowerType?.toConstantValueKind() ?: constructor.supertypes!!.first().toConstantValueKind()
@@ -47,7 +47,7 @@ internal class ConeTypeIdeRenderer(
fun renderType(type: ConeTypeProjection): String = buildString {
when (type) {
is ConeKotlinErrorType -> {
is ConeErrorType -> {
renderErrorType(type)
}
//is Dynamic??? -> append("dynamic")
@@ -90,7 +90,7 @@ internal class ConeTypeIdeRenderer(
}
}
private fun StringBuilder.renderErrorType(type: ConeKotlinErrorType) {
private fun StringBuilder.renderErrorType(type: ConeErrorType) {
val diagnostic = type.diagnostic
if (options.renderUnresolvedTypeAsResolved && diagnostic is ConeUnresolvedError) {
val qualifierRendered = diagnostic.qualifier?.let { FqName(it).render() }.orEmpty()
@@ -116,7 +116,7 @@ internal class KtFirFunctionalType(
}
internal class KtFirClassErrorType(
override val coneType: ConeClassErrorType,
override val coneType: ConeErrorType,
override val token: ValidityToken,
private val builder: KtSymbolByFirBuilder,
) : KtClassErrorType(), KtFirType {
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
import org.jetbrains.kotlin.fir.types.ConeClassErrorType
import org.jetbrains.kotlin.fir.types.ConeErrorType
import org.jetbrains.kotlin.fir.types.ConeKotlinType
import org.jetbrains.kotlin.fir.types.ConeNullability
import org.jetbrains.kotlin.fir.types.coneType
@@ -56,7 +56,7 @@ internal fun FirNamedReference.getReferencedElementType(): ConeKotlinType {
else -> error("Unexpected ${this::class}")
}
val firCallableDeclaration = symbols.singleOrNull()?.fir as? FirCallableDeclaration
?: return ConeClassErrorType(ConeUnresolvedNameError(name))
?: return ConeErrorType(ConeUnresolvedNameError(name))
return firCallableDeclaration.symbol.resolvedReturnType
}
@@ -95,4 +95,4 @@ internal fun FirExpression.asKtInitializerValue(): KtInitializerValue {
null -> KtNonConstantInitializerValue(ktExpression)
else -> KtConstantInitializerValue(evaluated, ktExpression)
}
}
}