From 1d96f810da03645d9bb11728bae040d4858d9e1b Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Tue, 30 Mar 2021 20:23:59 +0000 Subject: [PATCH] Native: fix target for ReturnsRetained and ConsumesReceiver annotations These annotations can be used on Objective-C property accessors imported to Kotlin. Note: the annotations aren't used in source code, only generated directly to metadata by cinterop. So this commit doesn't in fact fix anything but rather makes the implementation less fragile. See https://github.com/JetBrains/kotlin-native/issues/3336. --- .../kotlin/kotlinx/cinterop/internal/Annotations.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/internal/Annotations.kt b/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/internal/Annotations.kt index 29e47e06afc..790dbdcd510 100644 --- a/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/internal/Annotations.kt +++ b/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/internal/Annotations.kt @@ -40,11 +40,19 @@ public annotation class CCall(val id: String) { @Retention(AnnotationRetention.BINARY) annotation class WCString - @Target(AnnotationTarget.FUNCTION) + @Target( + AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER + ) @Retention(AnnotationRetention.BINARY) annotation class ReturnsRetained - @Target(AnnotationTarget.FUNCTION) + @Target( + AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER + ) @Retention(AnnotationRetention.BINARY) annotation class ConsumesReceiver