Support __nullable arguments in Objective-C blocks
When compiling my project I get lots of errors like these:
In file included from /Users/../SomeClass.m:12:
/Users/../SomeOtherClass.h:32:55: error: expected ')'
- (void)someMethod:(void (^)(NSError* __nullable error))block;
^
/Users/../SomeOtherClass.h:32:34: note: to match this '('
- (void)someMethod:(void (^)(NSError* __nullable error))block;
See https://developer.apple.com/swift/blog/?id=25 for more about the __nullable
Thanks @rist for reporting this issue! We are currently investigating it, the problem should be fixed soon.
Also getting this in @property attributes and return types, like:
warning: unknown warning option '-Wno-nullable-to-nonnull-conversion'; did you mean '-Wno-non-literal-null-conversion'? [-Wunknown-warning-option]
@property (nonatomic, copy, nullable) NSString *s;
^
error: expected ')'
- (UIViewController * __nullable)XXVC;
^
note: to match this '('
- (UIViewController * __nullable) XXVC;
^
Note also that within method declarations the nullable is not expected and thus infer fails as with an expected type error.
In file included from AppNavigation.m:9:
AppNavigation.h:19:4: error: expected a type
+ (nullable UIViewController *)getTopViewController;
^
AppNavigation.h:20:4: error: expected a type
+ (nullable ViewController *)getChatViewIfTopViewController; // Get any ViewController on Top
^
AppNavigation.h:21:4: error: expected a type
+ (nullable ViewController *)getViewController; // Get the ViewController with Bot
^
3 errors generated.
Command /Downloads/infer-osx-v0.1.1/infer/infer/bin/../lib/capture/clang failed with exit code 1
Yep, hitting the same issues with properties and method declarations.
We believe the issue has been fixed in master (e17308f4d57d0b867f777785bc67424b6efeebb7). The fix will make it into the next release of Infer later this week.
I compiled from master and this now works as expected. Thanks!
I'm seeing the same issue for nonnull. Not sure if the fix in e17308f addresses?
@altyus: yes, the patched version of clang we use now supports __nullable, __nonnull and __null_unspecified.