Skip to content

Commit

Permalink
[paramNotNull] Example that doesn't work
Browse files Browse the repository at this point in the history
Summary: This is an example false positive that we want to prevent. It's a FP because of the Nonnull annotation of `NewAnnotateBlock`.

Reviewed By: ngorogiannis

Differential Revision: D64039554

fbshipit-source-id: b132450addec37adf6f4e92d2df6c3faaa77ffd3
  • Loading branch information
dulmarod authored and facebook-github-bot committed Oct 8, 2024
1 parent f19d7e0 commit 6b1228c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,23 @@ + (void)block_call_safe_on_queue_macro_ok:(MyBlock)completion {
}

@end

#ifdef __clang__
#pragma clang assume_nonnull begin
#endif

typedef void (^NewAnnotateBlock)(const char* _Nullable key, id _Nullable value);
typedef void (^_Nullable NewAnnotateSyncBlock)(
_Nonnull NewAnnotateBlock annotate);

#ifdef __clang__
#pragma clang assume_nonnull end
#endif

void MarkerAnnotateSync(NS_NOESCAPE _Nullable NewAnnotateSyncBlock block) {}

void LoadAndAnnotateOk_FP(NSString* composerSessionID) {
MarkerAnnotateSync(^(NewAnnotateBlock annotate) {
annotate("composer_session_id", composerSessionID);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:, 4, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2"
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockCheckedAssignNULLBad:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockCheckedAssignNULLBad:and:,Checking `block` for nil,Assigned,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block"
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:109, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `completion` of Blocks_as_parameters.uploadTaskWithRequestBad:fromFile:delegate:delegateQueue:completion:,Executing `completion`], "completion("=>"BLOCK_CALL_SAFE(completion"
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:201, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `annotate` of objc_block_Blocks_as_parameters.m:201,Executing `annotate`], "annotate("=>"BLOCK_CALL_SAFE(annotate, "

0 comments on commit 6b1228c

Please sign in to comment.