diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatchingContextImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatchingContextImpl.kt index e88ba734cbb..0b7adc18ed3 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatchingContextImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatchingContextImpl.kt @@ -375,7 +375,7 @@ class FirExpectActualMatchingContextImpl private constructor( override val DeclarationSymbolMarker.hasSourceAnnotationsErased: Boolean get() { val symbol = asSymbol() - return symbol.source != null || symbol.origin is FirDeclarationOrigin.Plugin + return symbol.source == null && symbol.origin !is FirDeclarationOrigin.Plugin } object Factory : FirExpectActualMatchingContextFactory { diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrExpectActualMatchingContext.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrExpectActualMatchingContext.kt index 170e4e1a49c..8ac7f101622 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrExpectActualMatchingContext.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrExpectActualMatchingContext.kt @@ -491,6 +491,6 @@ internal abstract class IrExpectActualMatchingContext( override val DeclarationSymbolMarker.hasSourceAnnotationsErased: Boolean get() { val ir = asIr() - return ir.sourceElement() != null || ir.origin is IrDeclarationOrigin.GeneratedByPlugin + return ir.sourceElement() == null && ir.origin !is IrDeclarationOrigin.GeneratedByPlugin } } diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualAnnotationMatchChecker.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualAnnotationMatchChecker.kt index 8d949d9bbf6..732d81606e1 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualAnnotationMatchChecker.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualAnnotationMatchChecker.kt @@ -47,7 +47,7 @@ object AbstractExpectActualAnnotationMatchChecker { // TODO(Roman.Efremov, KT-58551): fix actual typealias class members not checked in FE checkers // TODO(Roman.Efremov, KT-58551): check annotations on fake overrides in case of implicit actualization - val skipSourceAnnotations = !actualSymbol.hasSourceAnnotationsErased + val skipSourceAnnotations = actualSymbol.hasSourceAnnotationsErased val actualAnnotationsByName = actualSymbol.annotations.groupBy { it.classId } for (expectAnnotation in expectSymbol.annotations) { diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ClassicExpectActualMatchingContext.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ClassicExpectActualMatchingContext.kt index db4ddded00a..f66fdfc15a5 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ClassicExpectActualMatchingContext.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ClassicExpectActualMatchingContext.kt @@ -369,8 +369,8 @@ class ClassicExpectActualMatchingContext(val platformModule: ModuleDescriptor) : override val DeclarationSymbolMarker.hasSourceAnnotationsErased: Boolean get() { - return DescriptorUtils.getContainingSourceFile(asDescriptor()) != SourceFile.NO_SOURCE_FILE || - this is K1SyntheticClassifierSymbolMarker || - this is CallableMemberDescriptor && kind == CallableMemberDescriptor.Kind.SYNTHESIZED + return DescriptorUtils.getContainingSourceFile(asDescriptor()) == SourceFile.NO_SOURCE_FILE && + this !is K1SyntheticClassifierSymbolMarker && + !(this is CallableMemberDescriptor && kind == CallableMemberDescriptor.Kind.SYNTHESIZED) } }