From 0bd3e8f418fde27a2c41306110985273eab578cd Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 28 Jan 2022 14:37:03 +0300 Subject: [PATCH] [FIR] Rename ConeClassErrorType to ConeErrorType, drop ConeKotlinErrorType alias --- .../analysis/api/fir/KtSymbolByFirBuilder.kt | 2 +- .../api/fir/components/KtFirPsiTypeProvider.kt | 4 ++-- .../fir/components/KtFirReferenceShortener.kt | 2 +- .../api/fir/components/KtFirTypeCreator.kt | 4 ++-- .../api/fir/components/KtFirTypeProvider.kt | 2 +- .../FirCompileTimeConstantEvaluator.kt | 2 +- .../api/fir/renderer/ConeTypeIdeRenderer.kt | 4 ++-- .../kotlin/analysis/api/fir/types/FirKtType.kt | 2 +- .../kotlin/analysis/api/fir/utils/firUtils.kt | 6 +++--- .../checkers/ConeTypeCompatibilityChecker.kt | 4 ++-- .../fir/analysis/checkers/FirConstChecks.kt | 2 +- .../checkers/FirDeclarationInspector.kt | 2 +- .../kotlin/fir/analysis/checkers/FirHelpers.kt | 2 +- .../declaration/FirConstPropertyChecker.kt | 4 ++-- .../declaration/FirDelegatedPropertyChecker.kt | 4 ++-- .../FirDestructuringDeclarationChecker.kt | 2 +- .../FirImplementationMismatchChecker.kt | 4 ++-- ...irKClassWithIncorrectTypeArgumentChecker.kt | 4 ++-- .../checkers/declaration/FirOverrideChecker.kt | 2 +- .../FirPropertyAccessorsTypesChecker.kt | 8 ++++---- .../declaration/FirThrowableSubclassChecker.kt | 4 ++-- .../declaration/FirTopLevelTypeAliasChecker.kt | 2 +- .../FirEqualityCompatibilityChecker.kt | 2 +- .../expression/FirSuperReferenceChecker.kt | 6 +++--- .../expression/FirUselessElvisChecker.kt | 6 +++--- .../FirUselessTypeOperationCallChecker.kt | 4 ++-- .../AbstractDiagnosticCollectorVisitor.kt | 4 ++-- .../ErrorNodeDiagnosticCollectorComponent.kt | 4 ++-- .../diagnostics/removeTypeVariableTypes.kt | 2 +- .../kotlin/fir/types/ConeTypeUtils.kt | 2 +- .../jetbrains/kotlin/fir/types/ConeTypes.kt | 4 +--- .../jetbrains/kotlin/fir/types/TypeRenderer.kt | 4 ++-- .../jetbrains/kotlin/fir/dump/HtmlFirDump.kt | 2 +- .../fir/deserialization/FirTypeDeserializer.kt | 6 +++--- .../fir/serialization/FirElementSerializer.kt | 2 +- .../serialization/FirSerializerExtension.kt | 4 ++-- .../serialization/constant/ConstantValue.kt | 2 +- .../backend/jvm/FirJvmSerializerExtension.kt | 2 +- .../fir/backend/jvm/FirMetadataSerializer.kt | 2 +- .../kotlin/fir/backend/Fir2IrTypeConverter.kt | 2 +- .../kotlin/fir/java/FirJavaElementFinder.kt | 2 +- .../kotlin/fir/java/JavaTypeConversion.kt | 6 +++--- .../kotlin/fir/java/javaAnnotationsMapping.kt | 2 +- .../kotlin/fir/scopes/jvm/SignatureUtils.kt | 2 +- .../src/org/jetbrains/kotlin/fir/CopyUtils.kt | 2 +- .../jetbrains/kotlin/fir/resolve/ScopeUtils.kt | 2 +- .../kotlin/fir/resolve/SupertypeUtils.kt | 6 +++--- .../kotlin/fir/resolve/TypeExpansionUtils.kt | 2 +- .../kotlin/fir/resolve/calls/FirReceivers.kt | 2 +- .../fir/resolve/substitution/Substitutors.kt | 2 +- .../fir/scopes/FirKotlinScopeProvider.kt | 4 ++-- .../kotlin/fir/types/ConeInferenceContext.kt | 6 +++--- .../kotlin/fir/types/ConeTypeContext.kt | 4 ++-- .../jetbrains/kotlin/fir/types/TypeUtils.kt | 10 +++++----- .../jetbrains/kotlin/fir/FirCallResolver.kt | 2 +- .../kotlin/fir/resolve/ResolveUtils.kt | 4 ++-- .../kotlin/fir/resolve/SamResolution.kt | 4 ++-- .../calls/CallableReferenceResolution.kt | 2 +- .../inference/ConstraintSystemCompleter.kt | 4 ++-- .../fir/resolve/inference/InferenceUtils.kt | 2 +- .../providers/impl/FirTypeResolverImpl.kt | 18 +++++++++--------- ...irCallCompletionResultsWriterTransformer.kt | 2 +- .../FirSpecificTypeResolverTransformer.kt | 8 ++++---- .../body/resolve/BodyResolveUtils.kt | 2 +- .../FirDeclarationsResolveTransformer.kt | 2 +- .../FirExpressionsResolveTransformer.kt | 2 +- .../kotlin/fir/FirLookupTrackerComponent.kt | 2 +- .../jetbrains/kotlin/fir/resolve/dfa/model.kt | 6 +++--- .../fir/types/ConeIntegerLiteralTypeImpl.kt | 2 +- .../fir/types/ConeKotlinTypeComparator.kt | 6 +++--- .../types/builder/FirErrorTypeRefBuilder.kt | 2 +- .../fir/types/impl/FirErrorTypeRefImpl.kt | 4 ++-- .../kotlin/fir/tree/generator/Types.kt | 4 ++-- .../jetbrains/kotlin/fir/FirResolveBench.kt | 6 +++--- .../kotlin/fir/RenderingForDebugInfo.kt | 4 ++-- .../compiler/visualizer/FirVisualizer.kt | 2 +- .../diagnostics/FirParcelizePropertyChecker.kt | 4 ++-- 77 files changed, 138 insertions(+), 140 deletions(-) diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/KtSymbolByFirBuilder.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/KtSymbolByFirBuilder.kt index 9c76f502c0f..6c67e27e710 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/KtSymbolByFirBuilder.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/KtSymbolByFirBuilder.kt @@ -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) diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirPsiTypeProvider.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirPsiTypeProvider.kt index 2f4a94f29e9..19c4a63d1ab 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirPsiTypeProvider.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirPsiTypeProvider.kt @@ -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) diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirReferenceShortener.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirReferenceShortener.kt index f77bab8eaa3..a611f07689f 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirReferenceShortener.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirReferenceShortener.kt @@ -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 diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirTypeCreator.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirTypeCreator.kt index 070fcd66cb3..0dd82005f14 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirTypeCreator.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirTypeCreator.kt @@ -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 -> { diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirTypeProvider.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirTypeProvider.kt index 09b8d6624f2..34e9eb4f732 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirTypeProvider.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirTypeProvider.kt @@ -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() diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/evaluate/FirCompileTimeConstantEvaluator.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/evaluate/FirCompileTimeConstantEvaluator.kt index 958faf0b198..aa067597d2b 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/evaluate/FirCompileTimeConstantEvaluator.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/evaluate/FirCompileTimeConstantEvaluator.kt @@ -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() diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/renderer/ConeTypeIdeRenderer.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/renderer/ConeTypeIdeRenderer.kt index 47d6ebf16dd..7e47b87ab18 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/renderer/ConeTypeIdeRenderer.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/renderer/ConeTypeIdeRenderer.kt @@ -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() diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/types/FirKtType.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/types/FirKtType.kt index fa2c0d4b7c4..a2d6681eaab 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/types/FirKtType.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/types/FirKtType.kt @@ -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 { diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/utils/firUtils.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/utils/firUtils.kt index 2945fa3ba08..aacf250415b 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/utils/firUtils.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/utils/firUtils.kt @@ -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) } -} \ No newline at end of file +} diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ConeTypeCompatibilityChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ConeTypeCompatibilityChecker.kt index 3f693ad61bb..b53c29cd3f9 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ConeTypeCompatibilityChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ConeTypeCompatibilityChecker.kt @@ -242,7 +242,7 @@ object ConeTypeCompatibilityChecker { private fun ConeKotlinType?.collectUpperBounds(): Set { if (this == null) return emptySet() return when (this) { - is ConeClassErrorType -> emptySet() // Ignore error types + is ConeErrorType -> emptySet() // Ignore error types is ConeLookupTagBasedType -> when (this) { is ConeClassLikeType -> setOf(this) is ConeTypeVariableType -> { @@ -267,7 +267,7 @@ object ConeTypeCompatibilityChecker { private fun ConeKotlinType?.collectLowerBounds(): Set { if (this == null) return emptySet() return when (this) { - is ConeClassErrorType -> emptySet() // Ignore error types + is ConeErrorType -> emptySet() // Ignore error types is ConeLookupTagBasedType -> when (this) { is ConeClassLikeType -> setOf(this) is ConeTypeVariableType -> emptySet() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirConstChecks.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirConstChecks.kt index ddbd2d0a075..f674796a605 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirConstChecks.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirConstChecks.kt @@ -61,7 +61,7 @@ internal fun checkConstantArguments( ?.typeRef ?.coneType - if (coneType is ConeClassErrorType) + if (coneType is ConeErrorType) return ConstantArgumentKind.NOT_CONST while (coneType?.classId == StandardClassIds.Array) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirDeclarationInspector.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirDeclarationInspector.kt index 81b13281c4b..a722837e845 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirDeclarationInspector.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirDeclarationInspector.kt @@ -68,7 +68,7 @@ interface FirDeclarationPresenter { appendRepresentation(it.original) append(it.nullability.suffix) } - is ConeClassErrorType -> { + is ConeErrorType -> { append("ERROR(") append(it.diagnostic.reason) append(')') diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt index 156e01804a3..1565babf4ab 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt @@ -616,7 +616,7 @@ fun checkTypeMismatch( internal fun checkCondition(condition: FirExpression, context: CheckerContext, reporter: DiagnosticReporter) { val coneType = condition.typeRef.coneTypeSafe()?.lowerBoundIfFlexible() if (coneType != null && - coneType !is ConeKotlinErrorType && + coneType !is ConeErrorType && !coneType.isSubtypeOf(context.session.typeContext, context.session.builtinTypes.booleanType.type) ) { reporter.reportOn( diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstPropertyChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstPropertyChecker.kt index 71bdf7454a6..7ce00125474 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstPropertyChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstPropertyChecker.kt @@ -18,7 +18,7 @@ import org.jetbrains.kotlin.fir.declarations.FirProperty import org.jetbrains.kotlin.fir.declarations.FirRegularClass import org.jetbrains.kotlin.fir.declarations.utils.isConst import org.jetbrains.kotlin.fir.resolve.fullyExpandedType -import org.jetbrains.kotlin.fir.types.ConeClassErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.lexer.KtTokens @@ -57,7 +57,7 @@ object FirConstPropertyChecker : FirPropertyChecker() { } val type = declaration.returnTypeRef.coneType.fullyExpandedType(context.session) - if ((type !is ConeClassErrorType) && !type.canBeUsedForConstVal()) { + if ((type !is ConeErrorType) && !type.canBeUsedForConstVal()) { reporter.reportOn(declaration.source, FirErrors.TYPE_CANT_BE_USED_FOR_CONST_VAL, declaration.returnTypeRef.coneType, context) return } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegatedPropertyChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegatedPropertyChecker.kt index 03b369de324..f986dfe51f8 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegatedPropertyChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegatedPropertyChecker.kt @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateErr import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableWrongReceiver import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol -import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.render import org.jetbrains.kotlin.fir.types.typeContext @@ -39,7 +39,7 @@ object FirDelegatedPropertyChecker : FirPropertyChecker() { // TODO: Also suppress delegate issue if type inference failed. For example, in // compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.fir.kt, no delegate issues are // reported due to the inference issue. - if (delegateType is ConeKotlinErrorType) { + if (delegateType is ConeErrorType) { val delegateSource = delegate.source // Implicit recursion type is not reported since the type ref does not have a real source. if (delegateSource != null && (delegateType.diagnostic as? ConeSimpleDiagnostic)?.kind == DiagnosticKind.RecursionInImplicitTypes) { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt index 56587968ed6..f2502af10a9 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt @@ -146,7 +146,7 @@ object FirDestructuringDeclarationChecker : FirPropertyChecker() { } is ConeConstraintSystemHasContradiction -> { val componentType = componentCall.typeRef.coneType - if (componentType is ConeKotlinErrorType) { + if (componentType is ConeErrorType) { // There will be other errors on this error type. return } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirImplementationMismatchChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirImplementationMismatchChecker.kt index 9b31aab2d94..b3e845c77d7 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirImplementationMismatchChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirImplementationMismatchChecker.kt @@ -27,7 +27,7 @@ import org.jetbrains.kotlin.fir.scopes.getDirectOverriddenProperties import org.jetbrains.kotlin.fir.scopes.impl.delegatedWrapperData import org.jetbrains.kotlin.fir.scopes.impl.toConeType import org.jetbrains.kotlin.fir.symbols.impl.* -import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.typeContext @@ -126,7 +126,7 @@ object FirImplementationMismatchChecker : FirClassChecker() { it to context.returnTypeCalculator.tryCalculateReturnType(it).coneType } - if (withTypes.any { it.second is ConeKotlinErrorType }) return + if (withTypes.any { it.second is ConeErrorType }) return var delegation: FirCallableSymbol<*>? = null val implementations = mutableListOf>() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirKClassWithIncorrectTypeArgumentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirKClassWithIncorrectTypeArgumentChecker.kt index cb8da7e7ac8..a441c4147d3 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirKClassWithIncorrectTypeArgumentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirKClassWithIncorrectTypeArgumentChecker.kt @@ -50,11 +50,11 @@ object FirKClassWithIncorrectTypeArgumentChecker : FirCallableDeclarationChecker argumentType.typeParameterFromError?.let { typeParameterSymbol -> return typeParameterSymbol.toConeType().isNullableType() } - return argumentType is ConeKotlinErrorType || argumentType.isNullableType() + return argumentType is ConeErrorType || argumentType.isNullableType() } } private val ConeKotlinType.typeParameterFromError: FirTypeParameterSymbol? - get() = ((this as? ConeKotlinErrorType)?.diagnostic as? ConeTypeParameterInQualifiedAccess)?.symbol + get() = ((this as? ConeErrorType)?.diagnostic as? ConeTypeParameterInQualifiedAccess)?.symbol } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirOverrideChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirOverrideChecker.kt index bacbb909db9..74c43710ad1 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirOverrideChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirOverrideChecker.kt @@ -214,7 +214,7 @@ object FirOverrideChecker : FirClassChecker() { val overridingReturnType = resolvedReturnTypeRef.coneType // Don't report *_ON_OVERRIDE diagnostics according to an error return type. That should be reported separately. - if (overridingReturnType is ConeKotlinErrorType) { + if (overridingReturnType is ConeErrorType) { return null } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirPropertyAccessorsTypesChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirPropertyAccessorsTypesChecker.kt index f52bc5b0342..8d6a55eeedf 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirPropertyAccessorsTypesChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirPropertyAccessorsTypesChecker.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.canHaveAbstractDeclaration import org.jetbrains.kotlin.fir.declarations.utils.isAbstract import org.jetbrains.kotlin.fir.declarations.utils.isOpen import org.jetbrains.kotlin.fir.declarations.utils.visibility -import org.jetbrains.kotlin.fir.types.ConeClassErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.isUnit @@ -49,7 +49,7 @@ object FirPropertyAccessorsTypesChecker : FirPropertyChecker() { return } val getterReturnType = getterReturnTypeRef.coneType - if (propertyType is ConeClassErrorType || getterReturnType is ConeClassErrorType) { + if (propertyType is ConeErrorType || getterReturnType is ConeErrorType) { return } if (getterReturnType != property.returnTypeRef.coneType) { @@ -94,7 +94,7 @@ object FirPropertyAccessorsTypesChecker : FirPropertyChecker() { } val valueSetterType = valueSetterParameter.returnTypeRef.coneType val valueSetterTypeSource = valueSetterParameter.returnTypeRef.source - if (propertyType is ConeClassErrorType || valueSetterType is ConeClassErrorType) { + if (propertyType is ConeErrorType || valueSetterType is ConeErrorType) { return } @@ -105,7 +105,7 @@ object FirPropertyAccessorsTypesChecker : FirPropertyChecker() { } val setterReturnType = setter.returnTypeRef.coneType - if (propertyType is ConeClassErrorType || valueSetterType is ConeClassErrorType) { + if (propertyType is ConeErrorType || valueSetterType is ConeErrorType) { return } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirThrowableSubclassChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirThrowableSubclassChecker.kt index 883b657af5c..fe161b69225 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirThrowableSubclassChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirThrowableSubclassChecker.kt @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.classId import org.jetbrains.kotlin.fir.declarations.utils.isInner import org.jetbrains.kotlin.fir.declarations.utils.isLocal import org.jetbrains.kotlin.fir.declarations.utils.superConeTypes -import org.jetbrains.kotlin.fir.types.ConeClassErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType object FirThrowableSubclassChecker : FirClassChecker() { override fun check(declaration: FirClass, context: CheckerContext, reporter: DiagnosticReporter) { @@ -37,7 +37,7 @@ object FirThrowableSubclassChecker : FirClassChecker() { } private fun FirClass.hasThrowableSupertype(context: CheckerContext) = - superConeTypes.any { it !is ConeClassErrorType && it.isSubtypeOfThrowable(context.session) } + superConeTypes.any { it !is ConeErrorType && it.isSubtypeOfThrowable(context.session) } private fun FirClass.hasGenericOuterDeclaration(context: CheckerContext): Boolean { if (!classId.isLocal) return false diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTopLevelTypeAliasChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTopLevelTypeAliasChecker.kt index b81bc9f8bf0..944a6b6da0f 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTopLevelTypeAliasChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTopLevelTypeAliasChecker.kt @@ -46,7 +46,7 @@ object FirTopLevelTypeAliasChecker : FirTypeAliasChecker() { val fullyExpandedType = expandedTypeRef.coneType.fullyExpandedType(context.session) if (containsTypeParameter(fullyExpandedType) || - fullyExpandedType is ConeClassErrorType && fullyExpandedType.diagnostic is ConeUnsupportedDynamicType + fullyExpandedType is ConeErrorType && fullyExpandedType.diagnostic is ConeUnsupportedDynamicType ) { reporter.reportOn( declaration.expandedTypeRef.source, diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirEqualityCompatibilityChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirEqualityCompatibilityChecker.kt index 15b7fbd1bc6..71673337567 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirEqualityCompatibilityChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirEqualityCompatibilityChecker.kt @@ -120,7 +120,7 @@ object FirEqualityCompatibilityChecker : FirEqualityOperatorCallChecker() { lType.isNullableNothing -> rType else -> return } - if (type is ConeKotlinErrorType) return + if (type is ConeErrorType) return val isPositiveCompare = expression.operation == FirOperation.EQ || expression.operation == FirOperation.IDENTITY val compareResult = with(context.session.typeContext) { when { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirSuperReferenceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirSuperReferenceChecker.kt index 71fa75ea7c8..6d2c7ecdcf5 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirSuperReferenceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirSuperReferenceChecker.kt @@ -11,7 +11,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.diagnostics.reportOn import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.references.FirSuperReference -import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef import org.jetbrains.kotlin.fir.types.FirUserTypeRef import org.jetbrains.kotlin.fir.types.coneType @@ -26,9 +26,9 @@ object FirSuperReferenceChecker : FirQualifiedAccessExpressionChecker() { val typeArgumentList = delegatedTypeRef.qualifier.firstOrNull()?.typeArgumentList ?: return val superType = superTypeRef.coneType - if (superType !is ConeKotlinErrorType && + if (superType !is ConeErrorType && typeArgumentList.typeArguments.isNotEmpty() && - superType.typeArguments.all { it !is ConeKotlinErrorType } + superType.typeArguments.all { it !is ConeErrorType } ) { reporter.reportOn(typeArgumentList.source, FirErrors.TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER, context) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUselessElvisChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUselessElvisChecker.kt index 46086515948..c1053e5fef3 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUselessElvisChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUselessElvisChecker.kt @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.diagnostics.reportOn import org.jetbrains.kotlin.fir.expressions.FirElvisExpression -import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.canBeNull import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.isNullLiteral @@ -20,10 +20,10 @@ object FirUselessElvisChecker : FirElvisExpressionChecker() { // If the overall expression is not resolved/completed, the corresponding error will be reported separately. // See [FirControlFlowStatementsResolveTransformer#transformElvisExpression], // where an error type is recorded as the expression's return type. - if (expression.typeRef.coneType is ConeKotlinErrorType) return + if (expression.typeRef.coneType is ConeErrorType) return val lhsType = expression.lhs.typeRef.coneType - if (lhsType is ConeKotlinErrorType) return + if (lhsType is ConeErrorType) return if (!lhsType.canBeNull) { reporter.reportOn(expression.source, FirErrors.USELESS_ELVIS, lhsType, context) return diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUselessTypeOperationCallChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUselessTypeOperationCallChecker.kt index 475d4b8542f..d2621379b42 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUselessTypeOperationCallChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUselessTypeOperationCallChecker.kt @@ -22,10 +22,10 @@ object FirUselessTypeOperationCallChecker : FirTypeOperatorCallChecker() { val arg = expression.argument val candidateType = arg.typeRef.coneType.upperBoundIfFlexible().fullyExpandedType(context.session) - if (candidateType is ConeKotlinErrorType) return + if (candidateType is ConeErrorType) return val targetType = expression.conversionTypeRef.coneType.fullyExpandedType(context.session) - if (targetType is ConeKotlinErrorType) return + if (targetType is ConeErrorType) return // x as? Type <=> x as Type? val refinedTargetType = diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/AbstractDiagnosticCollectorVisitor.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/AbstractDiagnosticCollectorVisitor.kt index 5c7f21c07e5..3d629004fd2 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/AbstractDiagnosticCollectorVisitor.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/AbstractDiagnosticCollectorVisitor.kt @@ -177,7 +177,7 @@ abstract class AbstractDiagnosticCollectorVisitor( // as children in delegatedTypeRef. We should make sure those elements are only visited once, otherwise diagnostics will be // collected twice: once through resolvedTypeRef's children and another through resolvedTypeRef.delegatedTypeRef's children. val resolvedTypeRefType = resolvedTypeRef.type - if (resolvedTypeRefType is ConeClassErrorType) { + if (resolvedTypeRefType is ConeErrorType) { super.visitResolvedTypeRef(resolvedTypeRef, data) } if (resolvedTypeRef.source?.kind is KtFakeSourceElementKind) return @@ -185,7 +185,7 @@ abstract class AbstractDiagnosticCollectorVisitor( //the note about is just wrong //if we don't visit resolved type we can't make any diagnostics on them //so here we check resolvedTypeRef - if (resolvedTypeRefType !is ConeClassErrorType) { + if (resolvedTypeRefType !is ConeErrorType) { withAnnotationContainer(resolvedTypeRef) { checkElement(resolvedTypeRef) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt index b58ee319b4e..a77c37b7ca4 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt @@ -21,7 +21,7 @@ import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.resolve.diagnostics.* -import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.FirErrorTypeRef import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef import org.jetbrains.kotlin.fir.types.render @@ -41,7 +41,7 @@ class ErrorNodeDiagnosticCollectorComponent( } override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef, data: CheckerContext) { - assert(resolvedTypeRef.type !is ConeKotlinErrorType) { + assert(resolvedTypeRef.type !is ConeErrorType) { "Instead use FirErrorTypeRef for ${resolvedTypeRef.type.render()}" } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/removeTypeVariableTypes.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/removeTypeVariableTypes.kt index 66205d99d13..8dd632c6422 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/removeTypeVariableTypes.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/removeTypeVariableTypes.kt @@ -28,6 +28,6 @@ private class TypeVariableTypeRemovingSubstitutor(typeContext: ConeTypeContext) check(originalTypeParameter is ConeTypeParameterLookupTag) return ConeTypeParameterTypeImpl(originalTypeParameter, type.isNullable, type.attributes) } - return ConeClassErrorType(ConeUnknownLambdaParameterTypeDiagnostic()) + return ConeErrorType(ConeUnknownLambdaParameterTypeDiagnostic()) } } diff --git a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypeUtils.kt b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypeUtils.kt index 3a0cf29209c..1b6ad0fed9f 100644 --- a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypeUtils.kt +++ b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypeUtils.kt @@ -54,7 +54,7 @@ private fun ConeKotlinType.contains(predicate: (ConeKotlinType) -> Boolean, visi fun ConeClassLikeType.withArguments(typeArguments: Array): ConeClassLikeType = when (this) { is ConeClassLikeTypeImpl -> ConeClassLikeTypeImpl(lookupTag, typeArguments, isNullable, attributes) - is ConeClassErrorType -> this + is ConeErrorType -> this else -> error("Unknown cone type: ${this::class}") } 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 1cd24cac783..e1c4c6aa8a2 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 @@ -37,11 +37,9 @@ sealed class ConeKotlinType : ConeKotlinTypeProjection(), KotlinTypeMarker, Type sealed class ConeSimpleKotlinType : ConeKotlinType(), SimpleTypeMarker -typealias ConeKotlinErrorType = ConeClassErrorType - class ConeClassLikeErrorLookupTag(override val classId: ClassId) : ConeClassLikeLookupTag() -class ConeClassErrorType(val diagnostic: ConeDiagnostic, val isUninferredParameter: Boolean = false) : ConeClassLikeType() { +class ConeErrorType(val diagnostic: ConeDiagnostic, val isUninferredParameter: Boolean = false) : ConeClassLikeType() { override val lookupTag: ConeClassLikeLookupTag get() = ConeClassLikeErrorLookupTag(ClassId.fromString("")) diff --git a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/TypeRenderer.kt b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/TypeRenderer.kt index 06d1c7a8d57..5b61e592072 100644 --- a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/TypeRenderer.kt +++ b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/TypeRenderer.kt @@ -10,11 +10,11 @@ import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract fun ConeKotlinType.render(): String { - val nullabilitySuffix = if (this !is ConeFlexibleType && this !is ConeClassErrorType) nullability.suffix else "" + val nullabilitySuffix = if (this !is ConeFlexibleType && this !is ConeErrorType) nullability.suffix else "" return when (this) { is ConeTypeVariableType -> "${renderAttributes()}TypeVariable(${this.lookupTag.name})" is ConeDefinitelyNotNullType -> "${original.render()} & Any" - is ConeClassErrorType -> "${renderAttributes()}ERROR CLASS: ${diagnostic.reason}" + is ConeErrorType -> "${renderAttributes()}ERROR CLASS: ${diagnostic.reason}" is ConeCapturedType -> "${renderAttributes()}CapturedType(${constructor.projection.render()})" is ConeClassLikeType -> { buildString { diff --git a/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt b/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt index aa4bf9c371a..e90cb2032d9 100644 --- a/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt +++ b/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt @@ -843,7 +843,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver private fun FlowContent.generate(type: ConeKotlinType) { when (type) { - is ConeClassErrorType -> error { +type.diagnostic.reason } + is ConeErrorType -> error { +type.diagnostic.reason } is ConeClassLikeType -> return generate(type) is ConeTypeParameterType -> resolved { symbolRef(type.lookupTag.symbol) { diff --git a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt index df2957b3e72..57070460cb1 100644 --- a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt +++ b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt @@ -118,7 +118,7 @@ class FirTypeDeserializer( return ConeFlexibleType(lowerBound!!, upperBound!!) } - return simpleType(proto, attributes) ?: ConeKotlinErrorType(ConeSimpleDiagnostic("?!id:0", DiagnosticKind.DeserializationError)) + return simpleType(proto, attributes) ?: ConeErrorType(ConeSimpleDiagnostic("?!id:0", DiagnosticKind.DeserializationError)) } private fun typeParameterSymbol(typeParameterId: Int): ConeTypeParameterLookupTag? = @@ -211,7 +211,7 @@ class FirTypeDeserializer( } else -> null } - return result ?: ConeClassErrorType( + return result ?: ConeErrorType( ConeSimpleDiagnostic( "Bad suspend function in metadata with constructor: $functionTypeConstructor", DiagnosticKind.DeserializationError @@ -240,7 +240,7 @@ class FirTypeDeserializer( val variance = ProtoEnumFlags.variance(typeArgumentProto.projection) val type = typeArgumentProto.type(typeTable) - ?: return ConeKotlinErrorType(ConeSimpleDiagnostic("No type recorded", DiagnosticKind.DeserializationError)) + ?: return ConeErrorType(ConeSimpleDiagnostic("No type recorded", DiagnosticKind.DeserializationError)) val coneType = type(type) return coneType.toTypeProjection(variance) } diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt index 61774f3c0ff..83dcf8db12e 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt @@ -652,7 +652,7 @@ class FirElementSerializer private constructor( val builder = ProtoBuf.Type.newBuilder() when (type) { is ConeDefinitelyNotNullType -> return typeProto(type.original, toSuper, correspondingTypeRef, isDefinitelyNotNullType = true) - is ConeKotlinErrorType -> { + is ConeErrorType -> { extension.serializeErrorType(type, builder) return builder } diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirSerializerExtension.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirSerializerExtension.kt index a29d7644a88..117b339ab89 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirSerializerExtension.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirSerializerExtension.kt @@ -9,7 +9,7 @@ import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.types.ConeFlexibleType -import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.metadata.ProtoBuf import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion import org.jetbrains.kotlin.metadata.serialization.MutableVersionRequirementTable @@ -83,7 +83,7 @@ abstract class FirSerializerExtension { open fun serializeTypeAlias(typeAlias: FirTypeAlias, proto: ProtoBuf.TypeAlias.Builder) { } - open fun serializeErrorType(type: ConeKotlinErrorType, builder: ProtoBuf.Type.Builder) { + open fun serializeErrorType(type: ConeErrorType, builder: ProtoBuf.Type.Builder) { throw IllegalStateException("Cannot serialize error type: $type") } diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/constant/ConstantValue.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/constant/ConstantValue.kt index 5e716a94101..bcac4fb7cf6 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/constant/ConstantValue.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/constant/ConstantValue.kt @@ -152,7 +152,7 @@ internal class KClassValue(value: Value) : ConstantValue(valu companion object { fun create(argumentType: ConeKotlinType): ConstantValue<*>? { - if (argumentType is ConeKotlinErrorType) return null + if (argumentType is ConeErrorType) return null if (argumentType !is ConeClassLikeType) return null var type = argumentType var arrayDimensions = 0 diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt index 367881a67b5..6c6bfdc823d 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt @@ -274,7 +274,7 @@ class FirJvmSerializerExtension( (grandParent.classKind == ClassKind.INTERFACE || grandParent.classKind == ClassKind.ANNOTATION_CLASS) } - override fun serializeErrorType(type: ConeKotlinErrorType, builder: ProtoBuf.Type.Builder) { + override fun serializeErrorType(type: ConeErrorType, builder: ProtoBuf.Type.Builder) { if (classBuilderMode === ClassBuilderMode.KAPT3) { builder.className = stringTable.getStringIndex(NON_EXISTENT_CLASS_NAME) return diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirMetadataSerializer.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirMetadataSerializer.kt index f0c3b874aea..d972678d838 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirMetadataSerializer.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirMetadataSerializer.kt @@ -47,7 +47,7 @@ class FirMetadataSerializer( ) : MetadataSerializer { private val approximator = object : AbstractTypeApproximator(session.typeContext, session.languageVersionSettings) { override fun createErrorType(debugName: String): SimpleTypeMarker { - return ConeKotlinErrorType(ConeIntermediateDiagnostic(debugName)) + return ConeErrorType(ConeIntermediateDiagnostic(debugName)) } } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt index 9e6b8af6e86..3d1c0bdcd53 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt @@ -106,7 +106,7 @@ class Fir2IrTypeConverter( addRawTypeAnnotation: Boolean = false ): IrType { return when (this) { - is ConeKotlinErrorType -> createErrorType() + is ConeErrorType -> createErrorType() is ConeLookupTagBasedType -> { val typeAnnotations = mutableListOf() typeAnnotations += with(annotationGenerator) { annotations.toIrAnnotations() } diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaElementFinder.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaElementFinder.kt index 9a022d181d0..ce4588c9c1b 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaElementFinder.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaElementFinder.kt @@ -266,7 +266,7 @@ private fun ConeKotlinType.mapToCanonicalString(session: FirSession): String { private fun ConeClassLikeType.mapToCanonicalString(session: FirSession): String { return when (this) { - is ConeClassErrorType -> ERROR_TYPE_STUB + is ConeErrorType -> ERROR_TYPE_STUB else -> fullyExpandedType(session).mapToCanonicalNoExpansionString(session) } } diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt index 86422f2b74c..3a94ae72ca8 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt @@ -59,7 +59,7 @@ internal fun FirTypeRef.toConeKotlinTypeProbablyFlexible( mode: FirJavaTypeConversionMode = FirJavaTypeConversionMode.DEFAULT ): ConeKotlinType = (resolveIfJavaType(session, javaTypeParameterStack, mode) as? FirResolvedTypeRef)?.type - ?: ConeKotlinErrorType(ConeSimpleDiagnostic("Type reference in Java not resolved: ${this::class.java}", DiagnosticKind.Java)) + ?: ConeErrorType(ConeSimpleDiagnostic("Type reference in Java not resolved: ${this::class.java}", DiagnosticKind.Java)) internal fun JavaType.toFirJavaTypeRef(session: FirSession, javaTypeParameterStack: JavaTypeParameterStack): FirJavaTypeRef { return buildJavaTypeRef { @@ -202,7 +202,7 @@ private fun JavaClassifierType.toConeKotlinTypeForFlexibleBound( val classId = ClassId.topLevel(FqName(this.classifierQualifiedName)) classId.constructClassLikeType(emptyArray(), isNullable = lowerBound != null, attributes) } - else -> ConeKotlinErrorType(ConeSimpleDiagnostic("Unexpected classifier: $classifier", DiagnosticKind.Java)) + else -> ConeErrorType(ConeSimpleDiagnostic("Unexpected classifier: $classifier", DiagnosticKind.Java)) } } @@ -233,7 +233,7 @@ private fun List.eraseToUpperBounds(session: FirSession) private fun FirTypeParameter.eraseToUpperBound(session: FirSession, cache: MutableMap): ConeKotlinType { return cache.getOrPut(this) { // Mark to avoid loops. - cache[this] = ConeKotlinErrorType(ConeIntermediateDiagnostic("self-recursive type parameter $name")) + cache[this] = ConeErrorType(ConeIntermediateDiagnostic("self-recursive type parameter $name")) // We can assume that Java type parameter bounds are already converted. symbol.resolvedBounds.first().coneType.eraseAsUpperBound(session, cache) } diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/javaAnnotationsMapping.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/javaAnnotationsMapping.kt index 70b8ac0227d..e3a0c7aa338 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/javaAnnotationsMapping.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/javaAnnotationsMapping.kt @@ -77,7 +77,7 @@ internal fun JavaAnnotationArgument.toFirExpression( typeRef = it buildResolvedTypeRef { type = it.coneTypeSafe()?.lowerBoundIfFlexible()?.arrayElementType() - ?: ConeClassErrorType(ConeSimpleDiagnostic("expected type is not array type")) + ?: ConeErrorType(ConeSimpleDiagnostic("expected type is not array type")) } } argumentList = buildArgumentList { diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/scopes/jvm/SignatureUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/scopes/jvm/SignatureUtils.kt index 56d0a983264..f0d27efa8fd 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/scopes/jvm/SignatureUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/scopes/jvm/SignatureUtils.kt @@ -111,7 +111,7 @@ private fun StringBuilder.appendConeType( } when (coneType) { - is ConeClassErrorType -> Unit // TODO: just skipping it seems wrong + is ConeErrorType -> Unit // TODO: just skipping it seems wrong is ConeClassLikeType -> { appendClassLikeType(coneType) } diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/CopyUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/CopyUtils.kt index 2167efbadeb..d426f3dfe04 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/CopyUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/CopyUtils.kt @@ -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 diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt index c920fc46482..d503aaa55f6 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt @@ -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 diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt index 35dcf624440..7c76172639c 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt @@ -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() 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) diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/TypeExpansionUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/TypeExpansionUtils.kt index 0cfaf16da17..ea96b2e839f 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/TypeExpansionUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/TypeExpansionUtils.kt @@ -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, diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt index 2525f467983..f241ea85468 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt @@ -46,7 +46,7 @@ abstract class AbstractExplicitReceiverValue : 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 diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt index 93705c16854..3e6382afe49 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt @@ -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 { diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/FirKotlinScopeProvider.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/FirKotlinScopeProvider.kt index 6e88f59a511..9986794a469 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/FirKotlinScopeProvider.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/FirKotlinScopeProvider.kt @@ -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( diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt index 8ec6048aadd..a8a9742c6fc 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt @@ -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 { diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt index 1f2b397b3dd..83303d36a62 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt @@ -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? { diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt index 6144dd9c26c..d12c81d99f8 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt @@ -96,7 +96,7 @@ fun T.withArguments(arguments: Array 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.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.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 diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt index 346c88093d5..6e762725b2f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt @@ -123,7 +123,7 @@ class FirCallResolver( resultExpression } val typeRef = components.typeFromCallee(resultFunctionCall) - if (typeRef.type is ConeKotlinErrorType) { + if (typeRef.type is ConeErrorType) { resultFunctionCall.resultType = typeRef } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt index a19c13c03a4..041fdbed3bc 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt @@ -60,7 +60,7 @@ fun FirFunction.constructFunctionalType(isSuspend: Boolean = false): ConeLookupT else -> null } val parameters = valueParameters.map { - it.returnTypeRef.coneTypeSafe() ?: ConeKotlinErrorType( + it.returnTypeRef.coneTypeSafe() ?: ConeErrorType( ConeSimpleDiagnostic( "No type for parameter", DiagnosticKind.ValueParameterWithNoTypeAnnotation @@ -235,7 +235,7 @@ fun BodyResolveComponents.typeFromCallee(access: T): FirReso val implicitReceiver = implicitReceiverStack[labelName] buildResolvedTypeRef { source = null - type = implicitReceiver?.type ?: ConeKotlinErrorType( + type = implicitReceiver?.type ?: ConeErrorType( ConeSimpleDiagnostic( "Unresolved this@$labelName", DiagnosticKind.UnresolvedLabel diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt index aa7b07b6855..26cc5c25dcf 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt @@ -61,7 +61,7 @@ class FirSamResolverImpl( getFunctionTypeForPossibleSamType(type.lowerBound)?.lowerBoundIfFlexible() ?: return null, getFunctionTypeForPossibleSamType(type.upperBound)?.upperBoundIfFlexible() ?: return null, ) - is ConeClassErrorType, is ConeStubType -> null + is ConeErrorType, is ConeStubType -> null // TODO: support those types as well is ConeTypeParameterType, is ConeTypeVariableType, is ConeCapturedType, is ConeDefinitelyNotNullType, is ConeIntersectionType, @@ -356,7 +356,7 @@ private val PUBLIC_METHOD_NAMES_IN_OBJECT = setOf("equals", "hashCode", "getClas private fun FirSimpleFunction.getFunctionTypeForAbstractMethod(): ConeLookupTagBasedType { val parameterTypes = valueParameters.map { - it.returnTypeRef.coneTypeSafe() ?: ConeKotlinErrorType(ConeIntermediateDiagnostic("No type for parameter $it")) + it.returnTypeRef.coneTypeSafe() ?: ConeErrorType(ConeIntermediateDiagnostic("No type for parameter $it")) } return createFunctionalType( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallableReferenceResolution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallableReferenceResolution.kt index 2ca83c978cd..6a2aa6c26f0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallableReferenceResolution.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallableReferenceResolution.kt @@ -138,7 +138,7 @@ private fun buildReflectionType( ) to callableReferenceAdaptation } is FirVariable -> createKPropertyType(fir, receiverType, returnTypeRef, candidate) to null - else -> ConeClassErrorType(ConeUnsupportedCallableReferenceTarget(candidate)) to null + else -> ConeErrorType(ConeUnsupportedCallableReferenceTarget(candidate)) to null } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt index 69c31f43ee9..78fce697eb1 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt @@ -18,7 +18,7 @@ import org.jetbrains.kotlin.fir.resolve.calls.ResolutionContext import org.jetbrains.kotlin.fir.resolve.inference.model.ConeFixVariableConstraintPosition import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.BodyResolveContext import org.jetbrains.kotlin.fir.returnExpressions -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.ConeTypeVariable import org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintSystemCompletionContext @@ -444,7 +444,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c } private fun createCannotInferErrorType(message: String, isUninferredParameter: Boolean = false) = - ConeClassErrorType( + ConeErrorType( ConeSimpleDiagnostic( message, DiagnosticKind.CannotInferParameterType, diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt index 732eda6ee1b..920f8fa3b43 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt @@ -78,7 +78,7 @@ fun extractLambdaInfoFromFunctionalType( argumentValueParameters.mapIndexed { index, parameter -> parameter.returnTypeRef.coneTypeSafe() ?: expectedParameters.getOrNull(index) - ?: ConeClassErrorType( + ?: ConeErrorType( ConeSimpleDiagnostic("Cannot infer type for parameter ${parameter.name}", DiagnosticKind.CannotInferParameterType) ) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt index 82e5fd1d02d..9f1dc38233d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt @@ -226,12 +226,12 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() { } else { ConeUnresolvedQualifierError(typeRef.render()) } - return ConeKotlinErrorType(diagnostic) + return ConeErrorType(diagnostic) } if (symbol is FirTypeParameterSymbol) { for (part in typeRef.qualifier) { if (part.typeArgumentList.typeArguments.isNotEmpty()) { - return ConeClassErrorType( + return ConeErrorType( ConeUnexpectedTypeArgumentsError("Type arguments not allowed", part.typeArgumentList.source) ) } @@ -304,7 +304,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() { allTypeArguments.add(substituted) } } else { - return ConeClassErrorType(ConeOuterClassArgumentsRequired(parameterClass.symbol)) + return ConeErrorType(ConeOuterClassArgumentsRequired(parameterClass.symbol)) } } @@ -403,14 +403,14 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() { symbol: FirClassLikeSymbol<*>, userTypeRef: FirUserTypeRef, qualifierPartArgumentsCount: Int? - ): ConeClassErrorType? { + ): ConeErrorType? { // TODO: It should be TYPE_ARGUMENTS_NOT_ALLOWED diagnostics when parameterClass is null val actualTypeParametersCount = getActualTypeParametersCount(parameterClass ?: symbol.fir) if (qualifierPartArgumentsCount == null || actualTypeParametersCount != qualifierPartArgumentsCount) { val source = getTypeArgumentsOrNameSource(userTypeRef, qualifierPartIndex) if (source != null) { - return ConeClassErrorType( + return ConeErrorType( ConeWrongNumberOfTypeArgumentsError( actualTypeParametersCount, parameterClass?.symbol ?: symbol, @@ -484,11 +484,11 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() { ) to diagnostic } is FirFunctionTypeRef -> createFunctionalType(typeRef) to null - is FirDynamicTypeRef -> ConeKotlinErrorType(ConeUnsupportedDynamicType()) to null + is FirDynamicTypeRef -> ConeErrorType(ConeUnsupportedDynamicType()) to null is FirIntersectionTypeRef -> { val (leftType, leftDiagnostic) = resolveType( typeRef.leftType - ?: return ConeKotlinErrorType(ConeSimpleDiagnostic("Problem during processing intersection type")) to null, + ?: return ConeErrorType(ConeSimpleDiagnostic("Problem during processing intersection type")) to null, scopeClassDeclaration, areBareTypesAllowed, isOperandOfIsOperator, @@ -497,7 +497,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() { ) val (rightType, _) = resolveType( typeRef.rightType - ?: return ConeKotlinErrorType(ConeSimpleDiagnostic("Problem during processing intersection type")) to null, + ?: return ConeErrorType(ConeSimpleDiagnostic("Problem during processing intersection type")) to null, scopeClassDeclaration, areBareTypesAllowed, isOperandOfIsOperator, @@ -508,7 +508,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() { if (rightType.isAny && leftType is ConeTypeParameterType) { ConeDefinitelyNotNullType(leftType) to leftDiagnostic //how properly concat (leftDiagnostic + rightDiagnostic)? } else { - ConeKotlinErrorType(ConeUnsupported("Intersection types are not supported yet", typeRef.source)) to null + ConeErrorType(ConeUnsupported("Intersection types are not supported yet", typeRef.source)) to null } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt index 88aeb6950da..ed683db5d65 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt @@ -500,7 +500,7 @@ class FirCallCompletionResultsWriterTransformer( val typeRef = argument.typeRef as FirResolvedTypeRef buildTypeProjectionWithVariance { source = argument.source - this.typeRef = if (typeRef.type is ConeClassErrorType) typeRef else typeRef.withReplacedConeType(type) + this.typeRef = if (typeRef.type is ConeErrorType) typeRef else typeRef.withReplacedConeType(type) variance = argument.variance } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt index 343928d00d5..96c16c7d20a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt @@ -107,7 +107,7 @@ class FirSpecificTypeResolverTransformer( ) val resolvedType = resolvedTypeWithDiagnostic.first.takeIfAcceptable() val diagnostic = resolvedTypeWithDiagnostic.second - return if (resolvedType != null && resolvedType !is ConeClassErrorType && diagnostic == null) { + return if (resolvedType != null && resolvedType !is ConeErrorType && diagnostic == null) { buildResolvedTypeRef { source = functionTypeRef.source type = resolvedType @@ -120,7 +120,7 @@ class FirSpecificTypeResolverTransformer( if (resolvedType != null) { type = resolvedType } - this.diagnostic = diagnostic ?: (resolvedType as? ConeClassErrorType)?.diagnostic + this.diagnostic = diagnostic ?: (resolvedType as? ConeErrorType)?.diagnostic ?: ConeSimpleDiagnostic("Unresolved functional type: ${functionTypeRef.render()}") } } @@ -128,7 +128,7 @@ class FirSpecificTypeResolverTransformer( private fun transformType(typeRef: FirTypeRef, resolvedType: ConeKotlinType, diagnostic: ConeDiagnostic?): FirResolvedTypeRef { return when { - resolvedType is ConeClassErrorType -> { + resolvedType is ConeErrorType -> { buildErrorTypeRef { val typeRefSourceKind = typeRef.source?.kind val diagnosticSource = resolvedType.diagnostic.safeAs() @@ -170,7 +170,7 @@ class FirSpecificTypeResolverTransformer( } private fun ConeKotlinType.takeIfAcceptable(): ConeKotlinType? = this.takeUnless { - !errorTypeAsResolved && it is ConeClassErrorType + !errorTypeAsResolved && it is ConeErrorType } override fun transformResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef, data: ScopeClassDeclaration): FirTypeRef { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt index 52adc19fc18..e2299c18780 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt @@ -106,7 +106,7 @@ fun FirBlock.writeResultType(session: FirSession) { fun ConstantValueKind<*>.expectedConeType(session: FirSession): ConeKotlinType { fun constructLiteralType(classId: ClassId, isNullable: Boolean = false): ConeKotlinType { val symbol = session.symbolProvider.getClassLikeSymbolByClassId(classId) - ?: return ConeClassErrorType(ConeSimpleDiagnostic("Missing stdlib class: $classId", DiagnosticKind.MissingStdlibClass)) + ?: return ConeErrorType(ConeSimpleDiagnostic("Missing stdlib class: $classId", DiagnosticKind.MissingStdlibClass)) return symbol.toLookupTag().constructClassType(emptyArray(), isNullable) } return when (this) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt index 3849809c46c..b9a12f10911 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt @@ -1067,7 +1067,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor valueParameter.transformReturnTypeRef( StoreType, valueParameter.returnTypeRef.resolvedTypeFromPrototype( - ConeKotlinErrorType( + ConeErrorType( ConeSimpleDiagnostic( "No type for parameter", DiagnosticKind.ValueParameterWithNoTypeAnnotation diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index 24df504c075..f2115278119 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -998,7 +998,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform is FirSuperReference -> { // TODO: unresolved supertype val supertype = reference.superTypeRef.coneTypeSafe() - ?.takeIf { it !is ConeClassErrorType } ?: return delegatedConstructorCall + ?.takeIf { it !is ConeErrorType } ?: return delegatedConstructorCall supertype.fullyExpandedType(session) } else -> return delegatedConstructorCall diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/FirLookupTrackerComponent.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/FirLookupTrackerComponent.kt index e8b55dd4c23..ea55bf9cbf8 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/FirLookupTrackerComponent.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/FirLookupTrackerComponent.kt @@ -40,7 +40,7 @@ fun FirLookupTrackerComponent.recordTypeResolveAsLookup(typeRef: FirTypeRef, sou if (source == null && fileSource == null) return // TODO: investigate all cases fun recordIfValid(type: ConeKotlinType) { - if (type is ConeKotlinErrorType) return // TODO: investigate whether some cases should be recorded, e.g. unresolved + if (type is ConeErrorType) return // TODO: investigate whether some cases should be recorded, e.g. unresolved type.classId?.let { if (!it.isLocal) { if (it.shortClassName.asString() != "Companion") { diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/model.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/model.kt index 615375ec3a5..2dfb544ff93 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/model.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/model.kt @@ -5,7 +5,7 @@ package org.jetbrains.kotlin.fir.resolve.dfa -import org.jetbrains.kotlin.fir.types.ConeClassErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.ConeKotlinType import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract @@ -86,14 +86,14 @@ infix fun DataFlowVariable.notEq(constant: Boolean?): OperationStatement { infix fun OperationStatement.implies(effect: Statement<*>): Implication = Implication(this, effect) infix fun RealVariable.typeEq(type: ConeKotlinType): TypeStatement = - if (type !is ConeClassErrorType) { + if (type !is ConeErrorType) { MutableTypeStatement(this, linkedSetOf().apply { this += type }, HashSet()) } else { MutableTypeStatement(this) } infix fun RealVariable.typeNotEq(type: ConeKotlinType): TypeStatement = - if (type !is ConeClassErrorType) { + if (type !is ConeErrorType) { MutableTypeStatement(this, linkedSetOf(), LinkedHashSet().apply { this += type }) } else { MutableTypeStatement(this) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeIntegerLiteralTypeImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeIntegerLiteralTypeImpl.kt index 336c11f266c..5a7e4f0f18e 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeIntegerLiteralTypeImpl.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeIntegerLiteralTypeImpl.kt @@ -171,7 +171,7 @@ private fun ConeClassLikeType.withNullability(nullability: ConeNullability): Con if (nullability == this.nullability) return this return when (this) { - is ConeClassErrorType -> this + is ConeErrorType -> this is ConeClassLikeTypeImpl -> ConeClassLikeTypeImpl(lookupTag, typeArguments, nullability.isNullable) else -> error("sealed") } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeKotlinTypeComparator.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeKotlinTypeComparator.kt index 2388f649dc9..410b25ae815 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeKotlinTypeComparator.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeKotlinTypeComparator.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.fir.types object ConeKotlinTypeComparator : Comparator { private val ConeKotlinType.priority : Int get() = when (this) { - is ConeKotlinErrorType -> 8 + is ConeErrorType -> 8 is ConeLookupTagBasedType -> 7 is ConeFlexibleType -> 6 is ConeCapturedType -> 5 @@ -72,8 +72,8 @@ object ConeKotlinTypeComparator : Comparator { } when (a) { - is ConeKotlinErrorType -> { - require(b is ConeKotlinErrorType) { + is ConeErrorType -> { + require(b is ConeErrorType) { "priority is inconsistent: ${a.render()} v.s. ${b.render()}" } return a.hashCode() - b.hashCode() diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/builder/FirErrorTypeRefBuilder.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/builder/FirErrorTypeRefBuilder.kt index 634e6dc46e0..e4953910ddd 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/builder/FirErrorTypeRefBuilder.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/builder/FirErrorTypeRefBuilder.kt @@ -11,7 +11,7 @@ import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder import org.jetbrains.kotlin.fir.builder.FirBuilderDsl import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic import org.jetbrains.kotlin.fir.expressions.FirAnnotation -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.FirErrorTypeRef import org.jetbrains.kotlin.fir.types.FirTypeRef diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeRefImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeRefImpl.kt index d915066ae86..324226d48c8 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeRefImpl.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeRefImpl.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.fir.types.impl import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic import org.jetbrains.kotlin.fir.expressions.FirAnnotation -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.FirErrorTypeRef import org.jetbrains.kotlin.fir.types.FirTypeRef @@ -22,7 +22,7 @@ internal class FirErrorTypeRefImpl( ) : FirErrorTypeRef() { constructor(source: KtSourceElement?, delegatedTypeRef: FirTypeRef?, diagnostic: ConeDiagnostic) : this( source, - ConeClassErrorType(diagnostic), + ConeErrorType(diagnostic), delegatedTypeRef, diagnostic ) diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/Types.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/Types.kt index a16daf0c636..97b69d4093a 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/Types.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/Types.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.tree.generator.context.generatedType import org.jetbrains.kotlin.fir.tree.generator.context.type -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.ConeSimpleKotlinType import org.jetbrains.kotlin.name.ClassId @@ -55,7 +55,7 @@ val emptyCfgReferenceType = generatedType("references.impl", "FirEmptyControlFlo val noReceiverExpressionType = generatedType("expressions.impl", "FirNoReceiverExpression") val implicitTypeRefType = generatedType("types.impl", "FirImplicitTypeRefImpl") val firQualifierPartType = type("fir.types", "FirQualifierPart") -val coneClassErrorTypeType = type(ConeClassErrorType::class) +val ConeErrorTypeType = type(ConeErrorType::class) val simpleNamedReferenceType = generatedType("references.impl", "FirSimpleNamedReference") val explicitThisReferenceType = generatedType("references.impl", "FirExplicitThisReference") val explicitSuperReferenceType = generatedType("references.impl", "FirExplicitSuperReference") diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt index 65837d16e20..9f28f4a4dbb 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt @@ -276,7 +276,7 @@ class FirResolveBench(val withProgress: Boolean, val listener: BenchListener? = val callee = functionCall.calleeReference if (typeRef is FirResolvedTypeRef) { val type = typeRef.type - if (type is ConeKotlinErrorType) { + if (type is ConeErrorType) { errorFunctionCallTypes++ val psi = callee.psi if (callee is FirErrorNamedReference && psi != null) { @@ -293,7 +293,7 @@ class FirResolveBench(val withProgress: Boolean, val listener: BenchListener? = val callee = qualifiedAccessExpression.calleeReference if (typeRef is FirResolvedTypeRef) { val type = typeRef.type - if (type is ConeKotlinErrorType) { + if (type is ConeErrorType) { errorQualifiedAccessTypes++ val psi = callee.psi if (callee is FirErrorNamedReference && psi != null) { @@ -329,7 +329,7 @@ class FirResolveBench(val withProgress: Boolean, val listener: BenchListener? = override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef) { resolvedTypes++ val type = resolvedTypeRef.type - if (type is ConeKotlinErrorType || type is ConeClassErrorType) { + if (type is ConeErrorType || type is ConeErrorType) { errorTypes++ if (resolvedTypeRef is FirErrorTypeRef && resolvedTypeRef.diagnostic is ConeStubDiagnostic) { return diff --git a/compiler/tests-compiler-utils/tests/org/jetbrains/kotlin/fir/RenderingForDebugInfo.kt b/compiler/tests-compiler-utils/tests/org/jetbrains/kotlin/fir/RenderingForDebugInfo.kt index 09079cc1f89..7b5f96c129f 100644 --- a/compiler/tests-compiler-utils/tests/org/jetbrains/kotlin/fir/RenderingForDebugInfo.kt +++ b/compiler/tests-compiler-utils/tests/org/jetbrains/kotlin/fir/RenderingForDebugInfo.kt @@ -8,11 +8,11 @@ package org.jetbrains.kotlin.fir import org.jetbrains.kotlin.fir.types.* fun ConeKotlinType.renderForDebugInfo(): String { - val nullabilitySuffix = if (this !is ConeKotlinErrorType && this !is ConeClassErrorType) nullability.suffix else "" + val nullabilitySuffix = if (this !is ConeErrorType && this !is ConeErrorType) nullability.suffix else "" return when (this) { is ConeTypeVariableType -> "TypeVariable(${this.lookupTag.name})" is ConeDefinitelyNotNullType -> "${original.renderForDebugInfo()}!!" - is ConeClassErrorType -> "ERROR CLASS: ${diagnostic.reason}" + is ConeErrorType -> "ERROR CLASS: ${diagnostic.reason}" is ConeCapturedType -> "CapturedType(${constructor.projection.renderForDebugInfo()})" is ConeClassLikeType -> { buildString { diff --git a/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/FirVisualizer.kt b/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/FirVisualizer.kt index db7a3ef9ad3..7fac7db1630 100644 --- a/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/FirVisualizer.kt +++ b/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/FirVisualizer.kt @@ -386,7 +386,7 @@ class FirVisualizer(private val firFile: FirFile) : BaseRenderer() { private fun ConeTypeProjection.localTypeRenderer(): String { val nullabilitySuffix = when { - this is ConeKotlinType && this !is ConeKotlinErrorType && this !is ConeClassErrorType -> nullability.suffix + this is ConeKotlinType && this !is ConeErrorType && this !is ConeErrorType -> nullability.suffix else -> "" } diff --git a/plugins/parcelize/parcelize-compiler/parcelize-fir/src/org/jetbrains/kotlin/parcelize/fir/diagnostics/FirParcelizePropertyChecker.kt b/plugins/parcelize/parcelize-compiler/parcelize-fir/src/org/jetbrains/kotlin/parcelize/fir/diagnostics/FirParcelizePropertyChecker.kt index 6dc7c10620d..5ea52c4bc37 100644 --- a/plugins/parcelize/parcelize-compiler/parcelize-fir/src/org/jetbrains/kotlin/parcelize/fir/diagnostics/FirParcelizePropertyChecker.kt +++ b/plugins/parcelize/parcelize-compiler/parcelize-fir/src/org/jetbrains/kotlin/parcelize/fir/diagnostics/FirParcelizePropertyChecker.kt @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.classId import org.jetbrains.kotlin.fir.resolve.lookupSuperTypes import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol -import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType +import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.classId import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.parcelize.ParcelizeNames.CREATOR_NAME @@ -64,7 +64,7 @@ object FirParcelizePropertyChecker : FirPropertyChecker() { reporter: DiagnosticReporter ) { val type = property.returnTypeRef.coneType - if (type is ConeKotlinErrorType || containingClassSymbol.hasCustomParceler(context.session)) return + if (type is ConeErrorType || containingClassSymbol.hasCustomParceler(context.session)) return /* * TODO: abstract code from ParcelSerializer or IrParcelSerializerFactory to avoid duplication * of allowed types checking