From 05cead2ab5986fc52a1a0e4f86ed6dcebf434d6b Mon Sep 17 00:00:00 2001 From: Roman Efremov Date: Thu, 3 Aug 2023 16:41:41 +0200 Subject: [PATCH] Fix implementation doesn't match name of property Currently, property `hasSourceAnnotationsErased` returns the opposite to what is stated in name. Invert it both in implementation and on call site. ^KT-58551 --- .../transformers/mpp/FirExpectActualMatchingContextImpl.kt | 2 +- .../common/actualizer/IrExpectActualMatchingContext.kt | 2 +- .../calls/mpp/AbstractExpectActualAnnotationMatchChecker.kt | 2 +- .../multiplatform/ClassicExpectActualMatchingContext.kt | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) 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) } }