[Nullable checker][Objective C] add test for nullable properties in NSArray

Summary: The case of nullable properties was already working but there was no test for it.

Reviewed By: dulmarod

Differential Revision: D8266468

fbshipit-source-id: c074d69
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent cf131081e3
commit a5129e57db

@ -18,6 +18,7 @@ typedef struct s_ {
- (T* _Nullable)nullableT; - (T* _Nullable)nullableT;
@property(nonatomic) S structProperty; @property(nonatomic) S structProperty;
@property(nonatomic) S* pointerProperty; @property(nonatomic) S* pointerProperty;
@property(nonatomic, nullable) NSObject* nullableProperty;
@end @end
@implementation T { @implementation T {
@ -128,6 +129,10 @@ typedef struct s_ {
return array; return array;
} }
- (NSArray*)nullablePropertyInNSArrayBad {
return @[ self.nullableMethod ]; // reports here
}
- (NSArray*)nullableMethodCheckedForNullAndReturnOkay { - (NSArray*)nullableMethodCheckedForNullAndReturnOkay {
NSObject* nullableObject = [self nullableMethod]; NSObject* nullableObject = [self nullableMethod];
NSArray* array; NSArray* array;

@ -12,6 +12,7 @@ codetoanalyze/objc/nullable/Examples.m, T_nullableKeyInNSDictionaryBad, 2, NULLA
codetoanalyze/objc/nullable/Examples.m, T_nullableKeyInNSDictionaryInitBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableKey,assignment of the nullable value,definition of nullableMethod] codetoanalyze/objc/nullable/Examples.m, T_nullableKeyInNSDictionaryInitBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableKey,assignment of the nullable value,definition of nullableMethod]
codetoanalyze/objc/nullable/Examples.m, T_nullableKeyInNSDictionaryInitLiteralBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableKey,assignment of the nullable value,definition of nullableMethod] codetoanalyze/objc/nullable/Examples.m, T_nullableKeyInNSDictionaryInitLiteralBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableKey,assignment of the nullable value,definition of nullableMethod]
codetoanalyze/objc/nullable/Examples.m, T_nullableObjectInNSArrayBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableObject,assignment of the nullable value,definition of nullableMethod] codetoanalyze/objc/nullable/Examples.m, T_nullableObjectInNSArrayBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableObject,assignment of the nullable value,definition of nullableMethod]
codetoanalyze/objc/nullable/Examples.m, T_nullablePropertyInNSArrayBad, 1, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereferencing the return of nullableMethod,assignment of the nullable value,definition of nullableMethod]
codetoanalyze/objc/nullable/Examples.m, T_nullableValueInNSDictionaryBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableValue,assignment of the nullable value,definition of nullableMethod] codetoanalyze/objc/nullable/Examples.m, T_nullableValueInNSDictionaryBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableValue,assignment of the nullable value,definition of nullableMethod]
codetoanalyze/objc/nullable/Examples.m, T_nullableValueInNSDictionaryInitBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableValue,assignment of the nullable value,definition of nullableMethod] codetoanalyze/objc/nullable/Examples.m, T_nullableValueInNSDictionaryInitBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableValue,assignment of the nullable value,definition of nullableMethod]
codetoanalyze/objc/nullable/Examples.m, T_nullableValueInNSDictionaryInitLiteralBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableValue,assignment of the nullable value,definition of nullableMethod] codetoanalyze/objc/nullable/Examples.m, T_nullableValueInNSDictionaryInitLiteralBad, 2, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereference of nullableValue,assignment of the nullable value,definition of nullableMethod]

Loading…
Cancel
Save