[FE] Skip more special annotations in KMP annotation matching
Many errors are reported in stdlib with these annotations (SinceKotlin, Deprecated, so on). But having them only on expect is a valid case. E.g. SinceKotlin added if some old platform-specific API becomes commonized. ^KT-58551
This commit is contained in:
committed by
Space Team
parent
1dcdcee452
commit
ad84c83ee9
+9
-4
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.mpp.ExpectActualMatchingContext
|
||||
import org.jetbrains.kotlin.resolve.calls.mpp.ExpectActualMatchingContext.AnnotationCallInfo
|
||||
import org.jetbrains.kotlin.resolve.checkers.OptInNames
|
||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||
import org.jetbrains.kotlin.types.TypeCheckerState
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
@@ -467,10 +468,14 @@ internal abstract class IrExpectActualMatchingContext(
|
||||
get() = irElement.type.getClass()?.classId
|
||||
|
||||
override val isRetentionSource: Boolean
|
||||
get() {
|
||||
val annotationClass = irElement.symbol.owner.parent as? IrClass ?: return false
|
||||
return annotationClass.getAnnotationRetention() == KotlinRetention.SOURCE
|
||||
}
|
||||
get() = getAnnotationClass()?.getAnnotationRetention() == KotlinRetention.SOURCE
|
||||
|
||||
override val isOptIn: Boolean
|
||||
get() = getAnnotationClass()?.hasAnnotation(OptInNames.REQUIRES_OPT_IN_FQ_NAME) ?: false
|
||||
|
||||
private fun getAnnotationClass(): IrClass? {
|
||||
return irElement.symbol.owner.parent as? IrClass
|
||||
}
|
||||
}
|
||||
|
||||
override val DeclarationSymbolMarker.hasSourceAnnotationsErased: Boolean
|
||||
|
||||
Reference in New Issue
Block a user