[FIR, IR] Commonize isFakeOverride check for AbstractExpectActualAnnotationMatchChecker

This commit fixes fakeOverrides.fir.kt test that got broken in the
previous commit

Previously isFakeOverride was only checked on IR backend. Now this check
is moved to AbstractExpectActualAnnotationMatchChecker which is used by
both: frontend and backend. That's why frontend no longer reports false
positive ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT

Review: https://jetbrains.team/p/kt/reviews/13094/timeline
This commit is contained in:
Nikita Bobko
2023-11-17 12:35:34 +01:00
committed by teamcity
parent e6bfcc7c65
commit 5b72c127bd
9 changed files with 34 additions and 34 deletions
@@ -454,8 +454,8 @@ internal abstract class IrExpectActualMatchingContext(
return !asIr().isFun
}
override fun CallableSymbolMarker.shouldSkipMatching(containingExpectClass: RegularClassSymbolMarker): Boolean {
return false
override fun CallableSymbolMarker.isFakeOverride(containingExpectClass: RegularClassSymbolMarker?): Boolean {
return asIr().isFakeOverride
}
override val CallableSymbolMarker.hasStableParameterNames: Boolean
@@ -25,13 +25,8 @@ internal object IrExpectActualAnnotationMatchingChecker : IrExpectActualChecker
if (expectSymbol is IrTypeParameterSymbol) {
continue
}
// If the expect declaration is fake-override and is incompatible, then it means that it was overridden on actual.
// In such case, regular rules for annotations on overridden declarations apply.
if (expectSymbol.isFakeOverride) {
continue
}
val incompatibility =
AbstractExpectActualAnnotationMatchChecker.areAnnotationsCompatible(expectSymbol, actualSymbol, matchingContext) ?: continue
val incompatibility = AbstractExpectActualAnnotationMatchChecker
.areAnnotationsCompatible(expectSymbol, actualSymbol, containingExpectClass = null, matchingContext) ?: continue
val reportOn = getTypealiasSymbolIfActualizedViaTypealias(expectSymbol.owner as IrDeclaration, classActualizationInfo)
?: getContainingActualClassIfFakeOverride(actualSymbol)