Files
swift-mirror/test/IRGen/Inputs/objc_implementation.h
Becca Royal-Gordon 01a90cc99b Support nil completions in @objcImpl async methods
An async @objc method only checks if its completion handler parameter is null if ClangImporter forces it to. This is fine for @objc with a generated header, because the generated header always declares the parameter _Nonnull, but clients ignore that annotation and pass nil anyway often enough that for @objc @implementation, we ought to be defensive.

We can achieve this by simply making the completion handler’s type Optional—SILGen already looks for this and knows what to do when it sees it.

Fixes rdar://130527373.
2024-06-25 20:36:41 -07:00

60 lines
1.0 KiB
Objective-C

#import <Foundation/Foundation.h>
@interface ImplClass: NSObject <NSCopying>
- (nonnull instancetype)init;
@property (assign) int implProperty;
- (void)mainMethod:(int)param;
- (void)asyncMethodWithCompletionHandler:(void (^ _Nullable)(void))completion;
@end
@interface ImplClass () <NSMutableCopying>
- (void)extensionMethod:(int)param;
@end
@interface ImplClass (Category1)
- (void)category1Method:(int)param;
@end
@interface ImplClass (Category2)
- (void)category2Method:(int)param;
@end
extern void implFunc(int param);
extern void implFuncCName(int param) __asm__("_implFuncAsmName");
@interface NoImplClass
- (void)noImplMethod:(int)param;
@end
@interface NoInitImplClass: NSObject
@property (readonly, strong, nonnull) NSString *s1;
@property (strong, nonnull) NSString *s2;
@property (readonly, strong, nonnull) NSString *s3;
@property (strong, nonnull) NSString *s4;
@end
@interface ImplClassWithResilientStoredProperty : NSObject
@property (assign) int beforeInt;
@property (assign) int afterInt;
@end