From 1a398e89ec9eaefb52bc9ed805ae669173936228 Mon Sep 17 00:00:00 2001 From: Ivan Kochurkin Date: Thu, 16 Jun 2022 13:43:18 +0300 Subject: [PATCH] [FIR] Add attributes to ConeErrorType for correct annotations resolving --- .../src/org/jetbrains/kotlin/fir/types/ConeTypes.kt | 9 +++++---- .../fir/resolve/providers/impl/FirTypeResolverImpl.kt | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) 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 3b1a3a8cb0b..f45d08f4678 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 @@ -39,7 +39,11 @@ sealed class ConeSimpleKotlinType : ConeKotlinType(), SimpleTypeMarker class ConeClassLikeErrorLookupTag(override val classId: ClassId) : ConeClassLikeLookupTag() -class ConeErrorType(val diagnostic: ConeDiagnostic, val isUninferredParameter: Boolean = false) : ConeClassLikeType() { +class ConeErrorType( + val diagnostic: ConeDiagnostic, + val isUninferredParameter: Boolean = false, + override val attributes: ConeAttributes = ConeAttributes.Empty +) : ConeClassLikeType() { override val lookupTag: ConeClassLikeLookupTag get() = ConeClassLikeErrorLookupTag(ClassId.fromString("")) @@ -49,9 +53,6 @@ class ConeErrorType(val diagnostic: ConeDiagnostic, val isUninferredParameter: B override val nullability: ConeNullability get() = ConeNullability.UNKNOWN - override val attributes: ConeAttributes - get() = ConeAttributes.Empty - override fun equals(other: Any?) = this === other override fun hashCode(): Int = System.identityHashCode(this) } 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 710f308fb0a..143a9b015ad 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 @@ -253,7 +253,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() { ConeUnresolvedQualifierError(typeRef.render()) } } - return ConeErrorType(diagnostic) + return ConeErrorType(diagnostic, attributes = typeRef.annotations.computeTypeAttributes(session)) } if (symbol is FirTypeParameterSymbol) { for (part in typeRef.qualifier) {