diff --git a/infer/tests/codetoanalyze/objc/nullable/Examples.m b/infer/tests/codetoanalyze/objc/nullable/Examples.m index 200d2d4e4..68d5630c3 100644 --- a/infer/tests/codetoanalyze/objc/nullable/Examples.m +++ b/infer/tests/codetoanalyze/objc/nullable/Examples.m @@ -18,6 +18,7 @@ typedef struct s_ { - (T* _Nullable)nullableT; @property(nonatomic) S structProperty; @property(nonatomic) S* pointerProperty; +@property(nonatomic, nullable) NSObject* nullableProperty; @end @implementation T { @@ -128,6 +129,10 @@ typedef struct s_ { return array; } +- (NSArray*)nullablePropertyInNSArrayBad { + return @[ self.nullableMethod ]; // reports here +} + - (NSArray*)nullableMethodCheckedForNullAndReturnOkay { NSObject* nullableObject = [self nullableMethod]; NSArray* array; diff --git a/infer/tests/codetoanalyze/objc/nullable/issues.exp b/infer/tests/codetoanalyze/objc/nullable/issues.exp index 2fab00362..eeaddedc1 100644 --- a/infer/tests/codetoanalyze/objc/nullable/issues.exp +++ b/infer/tests/codetoanalyze/objc/nullable/issues.exp @@ -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_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_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_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]