[K2] Correctly handle case when expect annotation is unresolved
Don't report if annotation has error type. Review: KT-MR-12250 ^KT-62026 Fixed
This commit is contained in:
committed by
Space Team
parent
04c1bf749c
commit
c88b4105c5
+10
-3
@@ -27,7 +27,6 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.mpp.ExpectActualCollectionArgumentsCompatibilityCheckStrategy
|
||||
import org.jetbrains.kotlin.resolve.calls.mpp.ExpectActualMatchingContext.AnnotationCallInfo
|
||||
import org.jetbrains.kotlin.mpp.SourceElementMarker
|
||||
import org.jetbrains.kotlin.resolve.checkers.OptInNames
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility
|
||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||
@@ -388,7 +387,7 @@ class FirExpectActualMatchingContextImpl private constructor(
|
||||
override val annotationSymbol: FirAnnotation = annotation
|
||||
|
||||
override val classId: ClassId?
|
||||
get() = annotation.toAnnotationClassId(actualSession)
|
||||
get() = getAnnotationConeType()?.lookupTag?.classId
|
||||
|
||||
override val isRetentionSource: Boolean
|
||||
get() = getAnnotationClass()?.getRetention(actualSession) == AnnotationRetention.SOURCE
|
||||
@@ -397,7 +396,15 @@ class FirExpectActualMatchingContextImpl private constructor(
|
||||
get() = getAnnotationClass()?.hasAnnotation(OptInNames.REQUIRES_OPT_IN_CLASS_ID, actualSession) ?: false
|
||||
|
||||
private fun getAnnotationClass(): FirRegularClassSymbol? =
|
||||
annotation.annotationTypeRef.coneType.toRegularClassSymbol(actualSession)
|
||||
getAnnotationConeType()?.toRegularClassSymbol(actualSession)
|
||||
|
||||
private fun getAnnotationConeType(): ConeClassLikeType? {
|
||||
val coneType = annotation.toAnnotationClassLikeType(actualSession)
|
||||
if (coneType is ConeErrorType) {
|
||||
return null
|
||||
}
|
||||
return coneType
|
||||
}
|
||||
}
|
||||
|
||||
override val DeclarationSymbolMarker.hasSourceAnnotationsErased: Boolean
|
||||
|
||||
Reference in New Issue
Block a user