From e79851910e1c1b7c440d3552e7be713dc0f6406a Mon Sep 17 00:00:00 2001 From: Roman Efremov Date: Fri, 4 Aug 2023 15:28:52 +0200 Subject: [PATCH] [FE, IR] Check annotations compatibility on expect and actual getters and setters ^KT-60671 --- ...DiagnosticsWithLightTreeTestGenerated.java | 6 +++ ...endMPPDiagnosticsWithPsiTestGenerated.java | 6 +++ ...ationIncompatibilityDiagnosticRenderers.kt | 3 ++ .../mpp/FirExpectActualMatchingContextImpl.kt | 3 ++ .../IrExpectActualMatchingContext.kt | 3 ++ ...tractExpectActualAnnotationMatchChecker.kt | 25 ++++++++++- .../calls/mpp/ExpectActualMatchingContext.kt | 1 + .../ClassicExpectActualMatchingContext.kt | 4 ++ .../checkDiagnosticFullText.diag.txt | 18 ++++---- .../checkDiagnosticFullText.fir.diag.txt | 17 ++++---- .../checkDiagnosticFullText.fir.kt | 7 ++++ .../checkDiagnosticFullText.kt | 7 ++++ .../gettersAndSetters.fir.kt | 42 +++++++++++++++++++ .../annotationMatching/gettersAndSetters.kt | 42 +++++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 6 +++ 15 files changed, 175 insertions(+), 15 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.fir.kt create mode 100644 compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.kt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java index 7a0f121fe22..99a7b2ae46f 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java @@ -854,6 +854,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/floatNumbersComparison.kt"); } + @Test + @TestMetadata("gettersAndSetters.kt") + public void testGettersAndSetters() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.kt"); + } + @Test @TestMetadata("intrinsicConstEvaluation.kt") public void testIntrinsicConstEvaluation() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java index 42dfbeb5f7b..61f6fe4f882 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java @@ -854,6 +854,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/floatNumbersComparison.kt"); } + @Test + @TestMetadata("gettersAndSetters.kt") + public void testGettersAndSetters() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.kt"); + } + @Test @TestMetadata("intrinsicConstEvaluation.kt") public void testIntrinsicConstEvaluation() throws Exception { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirExpectActualAnnotationIncompatibilityDiagnosticRenderers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirExpectActualAnnotationIncompatibilityDiagnosticRenderers.kt index 7a9e67a338d..5af5115dc8f 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirExpectActualAnnotationIncompatibilityDiagnosticRenderers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirExpectActualAnnotationIncompatibilityDiagnosticRenderers.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.renderer.FirRenderer import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.SymbolInternals import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualAnnotationsIncompatibilityType +import org.jetbrains.kotlin.utils.Printer internal object FirExpectActualAnnotationIncompatibilityDiagnosticRenderers { @OptIn(SymbolInternals::class) @@ -26,6 +27,8 @@ internal object FirExpectActualAnnotationIncompatibilityDiagnosticRenderers { modifierRenderer = null, contractRenderer = null, ).renderElementAsString(it.fir, trim = true) + // Write property accessors on the same line as the property + .run { replace(Printer.LINE_SEPARATOR, "") } } val INCOMPATIBILITY = Renderer { incompatibilityType: ExpectActualAnnotationsIncompatibilityType -> 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 df908c1c952..fd5d27778b4 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 @@ -142,6 +142,9 @@ class FirExpectActualMatchingContextImpl private constructor( override val PropertySymbolMarker.isConst: Boolean get() = asSymbol().resolvedStatus.isConst + override val PropertySymbolMarker.getter: FunctionSymbolMarker? + get() = asSymbol().getterSymbol + override val PropertySymbolMarker.setter: FunctionSymbolMarker? get() = asSymbol().setterSymbol 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 f2596a85525..3d7683aeb85 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 @@ -231,6 +231,9 @@ internal abstract class IrExpectActualMatchingContext( override val PropertySymbolMarker.isConst: Boolean get() = asIr().isConst + override val PropertySymbolMarker.getter: FunctionSymbolMarker? + get() = asIr().getter?.symbol + override val PropertySymbolMarker.setter: FunctionSymbolMarker? get() = asIr().setter?.symbol 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 63cac75f9f5..40f5c353fd5 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 @@ -80,6 +80,29 @@ object AbstractExpectActualAnnotationMatchChecker { commonForClassAndCallableChecks(expectSymbol, actualSymbol)?.let { return it } areAnnotationsOnValueParametersCompatible(expectSymbol, actualSymbol)?.let { return it } + if (expectSymbol is PropertySymbolMarker && actualSymbol is PropertySymbolMarker) { + arePropertyGetterAndSetterAnnotationsCompatible(expectSymbol, actualSymbol)?.let { return it } + } + + return null + } + + context (ExpectActualMatchingContext<*>) + private fun arePropertyGetterAndSetterAnnotationsCompatible( + expectSymbol: PropertySymbolMarker, + actualSymbol: PropertySymbolMarker, + ): Incompatibility? { + listOf( + expectSymbol.getter to actualSymbol.getter, + expectSymbol.setter to actualSymbol.setter, + ).forEach { (expectAccessor, actualAccessor) -> + if (expectAccessor != null && actualAccessor != null) { + areAnnotationsSetOnDeclarationsCompatible(expectAccessor, actualAccessor)?.let { + // Write containing declarations into diagnostic + return Incompatibility(expectSymbol, actualSymbol, actualAccessor.getSourceElement(), it.type) + } + } + } return null } @@ -165,7 +188,7 @@ object AbstractExpectActualAnnotationMatchChecker { expectSymbol: DeclarationSymbolMarker, actualSymbol: DeclarationSymbolMarker, ): Incompatibility? { - // TODO(Roman.Efremov, KT-58551): check other annotation targets (constructors, types, value parameters, etc) + // TODO(Roman.Efremov, KT-60671): check annotations set on types val skipSourceAnnotations = actualSymbol.hasSourceAnnotationsErased val actualAnnotationsByName = actualSymbol.annotations.groupBy { it.classId } diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualMatchingContext.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualMatchingContext.kt index 667306c5a65..463a88b859f 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualMatchingContext.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualMatchingContext.kt @@ -99,6 +99,7 @@ interface ExpectActualMatchingContext : TypeSystemC val PropertySymbolMarker.isLateinit: Boolean val PropertySymbolMarker.isConst: Boolean + val PropertySymbolMarker.getter: FunctionSymbolMarker? val PropertySymbolMarker.setter: FunctionSymbolMarker? fun createExpectActualTypeParameterSubstitutor( 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 bf891193fab..bd48e01284e 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ClassicExpectActualMatchingContext.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ClassicExpectActualMatchingContext.kt @@ -136,6 +136,10 @@ class ClassicExpectActualMatchingContext( get() = asDescriptor().isLateInit override val PropertySymbolMarker.isConst: Boolean get() = asDescriptor().isConst + + override val PropertySymbolMarker.getter: FunctionSymbolMarker? + get() = asDescriptor().getter + override val PropertySymbolMarker.setter: FunctionSymbolMarker? get() = asDescriptor().setter diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.diag.txt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.diag.txt index 31ba12080f8..1234847d2cc 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.diag.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.diag.txt @@ -1,32 +1,36 @@ // -- Module: -- // -- Module: -- -/jvm.kt:39:14: warning: annotation `@Ann` is missing on actual declaration. +/jvm.kt:44:14: warning: annotation `@Ann` is missing on actual declaration. All annotations from expect `class OnClass defined in root package in file common.kt` must be present with the same arguments on actual `class OnClass defined in root package in file jvm.kt`, otherwise they might behave incorrectly. actual class OnClass ^ -/jvm.kt:42:16: warning: annotation `@Ann` is missing on actual declaration. +/jvm.kt:47:16: warning: annotation `@Ann` is missing on actual declaration. All annotations from expect `fun onMember(): Unit defined in OnMember` must be present with the same arguments on actual `fun onMember(): Unit defined in OnMember`, otherwise they might behave incorrectly. actual fun onMember() {} ^ -/jvm.kt:47:18: warning: annotation `@Ann` is missing on actual declaration. +/jvm.kt:52:18: warning: annotation `@Ann` is missing on actual declaration. All annotations from expect `class ViaTypealias defined in root package in file common.kt` must be present with the same arguments on actual `class ViaTypealiasImpl defined in root package in file jvm.kt`, otherwise they might behave incorrectly. actual typealias ViaTypealias = ViaTypealiasImpl ^ -/jvm.kt:52:18: warning: annotation `@Ann` is missing on actual declaration. +/jvm.kt:57:18: warning: annotation `@Ann` is missing on actual declaration. All annotations from expect `fun foo(): Unit defined in MemberScopeViaTypealias` must be present with the same arguments on actual `fun foo(): Unit defined in MemberScopeViaTypealiasImpl`, otherwise they might behave incorrectly. actual typealias MemberScopeViaTypealias = MemberScopeViaTypealiasImpl ^ -/jvm.kt:55:12: warning: annotation `@WithArg(s = "str")` has different arguments on actual declaration: `@WithArg(s = "other str")`. +/jvm.kt:60:12: warning: annotation `@WithArg(s = "str")` has different arguments on actual declaration: `@WithArg(s = "other str")`. All annotations from expect `fun withDifferentArg(): Unit defined in root package in file common.kt` must be present with the same arguments on actual `fun withDifferentArg(): Unit defined in root package in file jvm.kt`, otherwise they might behave incorrectly. actual fun withDifferentArg() {} ^ -/jvm.kt:57:12: warning: annotation `@Ann` is missing on actual declaration. +/jvm.kt:62:12: warning: annotation `@Ann` is missing on actual declaration. All annotations from expect `fun inValueParam(arg: String): Unit defined in root package in file common.kt` must be present with the same arguments on actual `fun inValueParam(arg: String): Unit defined in root package in file jvm.kt`, otherwise they might behave incorrectly. actual fun inValueParam(arg: String) {} ^ -/jvm.kt:59:16: warning: annotation `@Ann` is missing on actual declaration. +/jvm.kt:64:16: warning: annotation `@Ann` is missing on actual declaration. All annotations from expect `fun inTypeParam(): Unit defined in root package in file common.kt` must be present with the same arguments on actual `fun inTypeParam(): Unit defined in root package in file jvm.kt`, otherwise they might behave incorrectly. actual fun inTypeParam() {} ^ +/jvm.kt:66:12: warning: annotation `@Ann` is missing on actual declaration. +All annotations from expect `val onGetter: String defined in root package in file common.kt` must be present with the same arguments on actual `val onGetter: String defined in root package in file jvm.kt`, otherwise they might behave incorrectly. +actual val onGetter: String = "" + ^ diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.diag.txt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.diag.txt index f45301fd11d..bfa8e6991e1 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.diag.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.diag.txt @@ -1,20 +1,23 @@ -/jvm.kt:(98,105): warning: Annotation `@Ann()` is missing on actual declaration. +/jvm.kt:(103,110): warning: Annotation `@Ann()` is missing on actual declaration. All annotations from expect 'class OnClass : Any' must be present with the same arguments on actual 'class OnClass : Any', otherwise they might behave incorrectly. -/jvm.kt:(146,154): warning: Annotation `@Ann()` is missing on actual declaration. +/jvm.kt:(151,159): warning: Annotation `@Ann()` is missing on actual declaration. All annotations from expect 'fun onMember(): Unit' must be present with the same arguments on actual 'fun onMember(): Unit', otherwise they might behave incorrectly. -/jvm.kt:(204,216): warning: Annotation `@Ann()` is missing on actual declaration. +/jvm.kt:(209,221): warning: Annotation `@Ann()` is missing on actual declaration. All annotations from expect 'class ViaTypealias : Any' must be present with the same arguments on actual 'class ViaTypealiasImpl : Any', otherwise they might behave incorrectly. -/jvm.kt:(309,332): warning: Annotation `@Ann()` is missing on actual declaration. +/jvm.kt:(314,337): warning: Annotation `@Ann()` is missing on actual declaration. All annotations from expect 'fun foo(): Unit' must be present with the same arguments on actual 'fun foo(): Unit', otherwise they might behave incorrectly. -/jvm.kt:(397,413): warning: Annotation `@WithArg(s = String(str))` has different arguments on actual declaration: `@WithArg(s = String(other str))`. +/jvm.kt:(402,418): warning: Annotation `@WithArg(s = String(str))` has different arguments on actual declaration: `@WithArg(s = String(other str))`. All annotations from expect 'fun withDifferentArg(): Unit' must be present with the same arguments on actual 'fun withDifferentArg(): Unit', otherwise they might behave incorrectly. -/jvm.kt:(431,443): warning: Annotation `@Ann()` is missing on actual declaration. +/jvm.kt:(436,448): warning: Annotation `@Ann()` is missing on actual declaration. All annotations from expect 'fun inValueParam(arg: String): Unit' must be present with the same arguments on actual 'fun inValueParam(arg: String): Unit', otherwise they might behave incorrectly. -/jvm.kt:(476,487): warning: Annotation `@Ann()` is missing on actual declaration. +/jvm.kt:(481,492): warning: Annotation `@Ann()` is missing on actual declaration. All annotations from expect 'fun inTypeParam(): Unit' must be present with the same arguments on actual 'fun inTypeParam(): Unit', otherwise they might behave incorrectly. + +/jvm.kt:(510,518): warning: Annotation `@PROPERTY_GETTER:Ann()` is missing on actual declaration. +All annotations from expect 'val onGetter: String get(): String' must be present with the same arguments on actual 'val onGetter: String get(): String', otherwise they might behave incorrectly. diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.kt index 4b62c27d8b6..def0ae243d9 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.kt @@ -6,6 +6,8 @@ AnnotationTarget.CLASS, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE_PARAMETER, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER, ) annotation class Ann @@ -34,6 +36,9 @@ expect fun inValueParam(@Ann arg: String) expect fun <@Ann T> inTypeParam() +@get:Ann +expect val onGetter: String + // MODULE: m1-jvm()()(m1-common) // FILE: jvm.kt actual class OnClass @@ -57,3 +62,5 @@ actual fun withDifferentArg() {} actual fun inValueParam(arg: String) {} actual fun inTypeParam() {} + +actual val onGetter: String = "" diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.kt index 68cd1361dd1..5b808165880 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.kt @@ -6,6 +6,8 @@ AnnotationTarget.CLASS, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE_PARAMETER, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER, ) annotation class Ann @@ -34,6 +36,9 @@ expect fun inValueParam(@Ann arg: String) expect fun <@Ann T> inTypeParam() +@get:Ann +expect val onGetter: String + // MODULE: m1-jvm()()(m1-common) // FILE: jvm.kt actual class OnClass @@ -57,3 +62,5 @@ actual fun withDifferentArg() {} actual fun inValueParam(arg: String) {} actual fun inTypeParam() {} + +actual val onGetter: String = "" diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.fir.kt new file mode 100644 index 00000000000..86eb357ee4f --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.fir.kt @@ -0,0 +1,42 @@ +// MODULE: m1-common +// FILE: common.kt +@Target(AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) +annotation class Ann + +expect val onGetter: String + @Ann get + +expect val onGetterImplicit: String + @Ann get + +@get:Ann +expect val onGetterWithExplicitTarget: String + +@get:Ann +expect val explicitTargetMatchesWithoutTarget: String + +@get:Ann +expect val setOnPropertyWithoutTargetNotMatch: String + +expect var onSetter: String + @Ann set + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt +actual val onGetter: String + get() = "" + +actual val onGetterImplicit: String = "" + +actual val onGetterWithExplicitTarget: String + get() = "" + +actual val explicitTargetMatchesWithoutTarget: String + @Ann get() = "" + +@Ann +actual val setOnPropertyWithoutTargetNotMatch: String = "" + +actual var onSetter: String + get() = "" + set(_) {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.kt new file mode 100644 index 00000000000..1e153232ebf --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.kt @@ -0,0 +1,42 @@ +// MODULE: m1-common +// FILE: common.kt +@Target(AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) +annotation class Ann + +expect val onGetter: String + @Ann get + +expect val onGetterImplicit: String + @Ann get + +@get:Ann +expect val onGetterWithExplicitTarget: String + +@get:Ann +expect val explicitTargetMatchesWithoutTarget: String + +@get:Ann +expect val setOnPropertyWithoutTargetNotMatch: String + +expect var onSetter: String + @Ann set + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt +actual val onGetter: String + get() = "" + +actual val onGetterImplicit: String = "" + +actual val onGetterWithExplicitTarget: String + get() = "" + +actual val explicitTargetMatchesWithoutTarget: String + @Ann get() = "" + +@Ann +actual val setOnPropertyWithoutTargetNotMatch: String = "" + +actual var onSetter: String + get() = "" + set(_) {} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index bd8ca85a8da..965afb75033 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -23849,6 +23849,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/floatNumbersComparison.kt"); } + @Test + @TestMetadata("gettersAndSetters.kt") + public void testGettersAndSetters() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/gettersAndSetters.kt"); + } + @Test @TestMetadata("intrinsicConstEvaluation.kt") public void testIntrinsicConstEvaluation() throws Exception {