[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
+11
-1
@@ -10,6 +10,16 @@ import org.jetbrains.kotlin.mpp.TypeAliasSymbolMarker
|
||||
import org.jetbrains.kotlin.name.StandardClassIds
|
||||
|
||||
object AbstractExpectActualAnnotationMatchChecker {
|
||||
private val SKIPPED_CLASS_IDS = setOf(
|
||||
StandardClassIds.Annotations.Deprecated,
|
||||
StandardClassIds.Annotations.DeprecatedSinceKotlin,
|
||||
StandardClassIds.Annotations.OptionalExpectation,
|
||||
StandardClassIds.Annotations.RequireKotlin,
|
||||
StandardClassIds.Annotations.SinceKotlin,
|
||||
StandardClassIds.Annotations.Suppress,
|
||||
StandardClassIds.Annotations.WasExperimental,
|
||||
)
|
||||
|
||||
class Incompatibility(val expectSymbol: DeclarationSymbolMarker, val actualSymbol: DeclarationSymbolMarker)
|
||||
|
||||
fun areAnnotationsCompatible(
|
||||
@@ -36,7 +46,7 @@ object AbstractExpectActualAnnotationMatchChecker {
|
||||
val actualAnnotationsByName = actualSymbol.annotations.groupBy { it.classId }
|
||||
|
||||
for (expectAnnotation in expectSymbol.annotations) {
|
||||
if (expectAnnotation.classId == StandardClassIds.Annotations.OptionalExpectation) {
|
||||
if (expectAnnotation.classId in SKIPPED_CLASS_IDS || expectAnnotation.isOptIn) {
|
||||
continue
|
||||
}
|
||||
if (expectAnnotation.isRetentionSource && skipSourceAnnotations) {
|
||||
|
||||
+1
@@ -167,5 +167,6 @@ interface ExpectActualMatchingContext<T : DeclarationSymbolMarker> : TypeSystemC
|
||||
interface AnnotationCallInfo {
|
||||
val classId: ClassId?
|
||||
val isRetentionSource: Boolean
|
||||
val isOptIn: Boolean
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user