From ba50a8275c4e5a02424234212958bd0ec6fa6644 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Tue, 12 May 2020 06:35:33 +0300 Subject: [PATCH] Add test for [KT-3706] Issue is already fixed by metadata-based cinterop (cherry picked from commit fd4f5b2c07ebdc431d6243ac087f911ee30e88ca) --- .../tests/interop/objc/tests/KT37067_prefix.h | 12 +++++++++++ .../interop/objc/tests/KT37067_prefix.kt | 10 ++++++++++ .../tests/interop/objc/tests/KT37067_prefix.m | 20 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.h create mode 100644 kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.kt create mode 100644 kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.m diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.h b/kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.h new file mode 100644 index 00000000000..f6b9d121009 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.h @@ -0,0 +1,12 @@ +#import + + +@interface KT37067_Impl : NSObject + +@property (nonatomic, readonly) NSObject *newValue; +@property (nonatomic, readonly) NSObject *allocValue; +@property (nonatomic, readonly) NSObject *copyValue; +@property (nonatomic, readonly) NSObject *mutableCopyValue; + +@end; + diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.kt b/kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.kt new file mode 100644 index 00000000000..11f81af12e3 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.kt @@ -0,0 +1,10 @@ +import kotlin.test.* +import objcTests.* + +/// KT-37067: attribute prefixed with "new" causes cinterop failure +// No matter what is in the test: I only need to get it compilable with cinterop + +@Test fun testKT37067() { + val impl = KT37067_Impl() + assertEquals(null, impl.newValue) +} diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.m b/kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.m new file mode 100644 index 00000000000..1fa807e8f04 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/tests/KT37067_prefix.m @@ -0,0 +1,20 @@ +#include "KT37067_prefix.h" + +@implementation KT37067_Impl : NSObject + +/// KT-37067 is a cinterop issue, so .m implementaion is not relevant at all, +// but I still need to make objc compilable with `-fobjc-arc` option +- (NSObject *)newValue { + return nil; +} +- (NSObject *)allocValue { + return nil; +} +- (NSObject *)copyValue { + return nil; +} +- (NSObject *)mutableCopyValue { + return nil; +} + +@end;