[IR] Prevent duplicated reports of ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT

...on property accessors and enum entries.

^KT-62559
This commit is contained in:
Roman Efremov
2023-10-20 19:44:08 +02:00
committed by Space Team
parent 2b120f6cdc
commit 29c82c668f
7 changed files with 42 additions and 16 deletions
@@ -87,7 +87,9 @@ object AbstractExpectActualAnnotationMatchChecker {
commonForClassAndCallableChecks(expectSymbol, actualSymbol)?.let { return it }
areAnnotationsOnValueParametersCompatible(expectSymbol, actualSymbol)?.let { return it }
if (expectSymbol is PropertySymbolMarker && actualSymbol is PropertySymbolMarker) {
if (checkPropertyAccessorsForAnnotationsCompatibility
&& expectSymbol is PropertySymbolMarker && actualSymbol is PropertySymbolMarker
) {
arePropertyGetterAndSetterAnnotationsCompatible(expectSymbol, actualSymbol)?.let { return it }
}
@@ -136,7 +138,9 @@ object AbstractExpectActualAnnotationMatchChecker {
if (checkClassScopesForAnnotationCompatibility) {
checkAnnotationsInClassMemberScope(expectSymbol, actualSymbol)?.let { return it }
}
if (expectSymbol.classKind == ClassKind.ENUM_CLASS && actualSymbol.classKind == ClassKind.ENUM_CLASS) {
if (checkEnumEntriesForAnnotationsCompatibility && expectSymbol.classKind == ClassKind.ENUM_CLASS &&
actualSymbol.classKind == ClassKind.ENUM_CLASS
) {
checkAnnotationsOnEnumEntries(expectSymbol, actualSymbol)?.let { return it }
}
@@ -203,6 +203,18 @@ interface ExpectActualMatchingContext<T : DeclarationSymbolMarker> : TypeSystemC
val checkClassScopesForAnnotationCompatibility: Boolean
/**
* Whether it is needed to check getters and setters in [AbstractExpectActualAnnotationMatchChecker].
*/
val checkPropertyAccessorsForAnnotationsCompatibility: Boolean
get() = true
/**
* Whether it is needed to check enum entries in [AbstractExpectActualAnnotationMatchChecker].
*/
val checkEnumEntriesForAnnotationsCompatibility: Boolean
get() = true
/**
* Determines whether it is needed to skip checking annotations on class member in [AbstractExpectActualAnnotationMatchChecker].
*