From 977d1c0e41def926a1515fbc0bbfad18e0f0ebff Mon Sep 17 00:00:00 2001 From: Sebastian Sellmair Date: Mon, 27 Nov 2023 09:49:37 +0100 Subject: [PATCH] [K/N] Implement objc export header test: functionWithErrorType --- .../Fe10ObjCExportHeaderGeneratorTest.kt | 5 +++ .../!functionWithErrorType.h | 33 +++++++++++++++++++ .../objcexport/functionWithErrorType/Foo.kt | 1 + 3 files changed, 39 insertions(+) create mode 100644 kotlin-native/backend.native/functionalTest/testData/objcexport/functionWithErrorType/!functionWithErrorType.h create mode 100644 kotlin-native/backend.native/functionalTest/testData/objcexport/functionWithErrorType/Foo.kt diff --git a/kotlin-native/backend.native/functionalTest/src/org/jetbrains/kotlin/backend/konan/tests/Fe10ObjCExportHeaderGeneratorTest.kt b/kotlin-native/backend.native/functionalTest/src/org/jetbrains/kotlin/backend/konan/tests/Fe10ObjCExportHeaderGeneratorTest.kt index 4d63ca06363..57ce360a18d 100644 --- a/kotlin-native/backend.native/functionalTest/src/org/jetbrains/kotlin/backend/konan/tests/Fe10ObjCExportHeaderGeneratorTest.kt +++ b/kotlin-native/backend.native/functionalTest/src/org/jetbrains/kotlin/backend/konan/tests/Fe10ObjCExportHeaderGeneratorTest.kt @@ -102,4 +102,9 @@ class Fe10ObjCExportHeaderGeneratorTest : AbstractFE10ObjCExportHeaderGeneratorT fun `test - functionWithThrowsAnnotation`() { doTest(objCExportTestDataDir.resolve("functionWithThrowsAnnotation")) } + + @Test + fun `test - functionWithErrorType`() { + doTest(objCExportTestDataDir.resolve("functionWithErrorType")) + } } diff --git a/kotlin-native/backend.native/functionalTest/testData/objcexport/functionWithErrorType/!functionWithErrorType.h b/kotlin-native/backend.native/functionalTest/testData/objcexport/functionWithErrorType/!functionWithErrorType.h new file mode 100644 index 00000000000..afef5abc3bb --- /dev/null +++ b/kotlin-native/backend.native/functionalTest/testData/objcexport/functionWithErrorType/!functionWithErrorType.h @@ -0,0 +1,33 @@ +#import +#import +#import +#import +#import +#import +#import + +@class ERROR; + +NS_ASSUME_NONNULL_BEGIN +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" +#pragma clang diagnostic ignored "-Wincompatible-property-type" +#pragma clang diagnostic ignored "-Wnullability" + +#pragma push_macro("_Nullable_result") +#if !__has_feature(nullability_nullable_result) +#undef _Nullable_result +#define _Nullable_result _Nullable +#endif + +__attribute__((objc_subclassing_restricted)) +@interface FooKt : Base ++ (ERROR *)foo __attribute__((swift_name("foo()"))); +@end + +@interface ERROR : Base +@end + +#pragma pop_macro("_Nullable_result") +#pragma clang diagnostic pop +NS_ASSUME_NONNULL_END diff --git a/kotlin-native/backend.native/functionalTest/testData/objcexport/functionWithErrorType/Foo.kt b/kotlin-native/backend.native/functionalTest/testData/objcexport/functionWithErrorType/Foo.kt new file mode 100644 index 00000000000..dae719d5091 --- /dev/null +++ b/kotlin-native/backend.native/functionalTest/testData/objcexport/functionWithErrorType/Foo.kt @@ -0,0 +1 @@ +fun foo() = Unresolved \ No newline at end of file