[ObjCExport] Implement 'test - dispatchAndExtensionReceiverWithMustBeDocumentedAnnotation'

KT-64226
This commit is contained in:
Sebastian Sellmair
2024-01-08 08:53:56 +01:00
committed by Space Team
parent 90632ad746
commit 7dbd5cd57f
3 changed files with 55 additions and 0 deletions
@@ -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
}
@@ -0,0 +1,39 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSError.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSSet.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
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
@@ -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()
}