diff --git a/native/objcexport-header-generator/test/org/jetbrains/kotlin/backend/konan/tests/ObjCExportHeaderGeneratorTest.kt b/native/objcexport-header-generator/test/org/jetbrains/kotlin/backend/konan/tests/ObjCExportHeaderGeneratorTest.kt index 32cf51c29cf..b5810c21662 100644 --- a/native/objcexport-header-generator/test/org/jetbrains/kotlin/backend/konan/tests/ObjCExportHeaderGeneratorTest.kt +++ b/native/objcexport-header-generator/test/org/jetbrains/kotlin/backend/konan/tests/ObjCExportHeaderGeneratorTest.kt @@ -135,6 +135,11 @@ class ObjCExportHeaderGeneratorTest(val generator: HeaderGenerator) { doTest(headersTestDataDir.resolve("receiverWithMustBeDocumentedAnnotation")) } + @Test + fun `test - dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation`() { + doTest(headersTestDataDir.resolve("dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation")) + } + fun interface HeaderGenerator { fun generateHeaders(root: File): String } diff --git a/native/objcexport-header-generator/testData/headers/dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation/!dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation.h b/native/objcexport-header-generator/testData/headers/dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation/!dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation.h new file mode 100644 index 00000000000..31831c32f01 --- /dev/null +++ b/native/objcexport-header-generator/testData/headers/dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation/!dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation.h @@ -0,0 +1,39 @@ +#import +#import +#import +#import +#import +#import +#import + +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 + + +/** + * @note annotations + * AnotherImportantAnnotation +*/ +__attribute__((objc_subclassing_restricted)) +@interface Bar : Base +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); + +/** + * @param receiver annotations ImportantAnnotation +*/ +- (NSString *)foo:(id)receiver __attribute__((swift_name("foo(_:)"))); +@end + +#pragma pop_macro("_Nullable_result") +#pragma clang diagnostic pop +NS_ASSUME_NONNULL_END diff --git a/native/objcexport-header-generator/testData/headers/dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation/Foo.kt b/native/objcexport-header-generator/testData/headers/dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation/Foo.kt new file mode 100644 index 00000000000..4b1a12ebfb9 --- /dev/null +++ b/native/objcexport-header-generator/testData/headers/dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation/Foo.kt @@ -0,0 +1,11 @@ +@Target(AnnotationTarget.VALUE_PARAMETER) +@MustBeDocumented +annotation class ImportantAnnotation + +@MustBeDocumented +annotation class AnotherImportantAnnotation + +@AnotherImportantAnnotation +class Bar { + fun @receiver:ImportantAnnotation Any.foo() = toString() +}