diff --git a/infer/src/checkers/SelfInBlock.ml b/infer/src/checkers/SelfInBlock.ml index 0b10e1f42..528c675f7 100644 --- a/infer/src/checkers/SelfInBlock.ml +++ b/infer/src/checkers/SelfInBlock.ml @@ -80,10 +80,12 @@ let make_trace_elements domain = let report_issues summary domain = let weakSelf_opt = - TransferFunctions.Domain.find_first_opt (fun {kind} -> DomainData.is_weak_self kind) domain + TransferFunctions.Domain.filter (fun {kind} -> DomainData.is_weak_self kind) domain + |> TransferFunctions.Domain.choose_opt in let self_opt = - TransferFunctions.Domain.find_first_opt (fun {kind} -> DomainData.is_self kind) domain + TransferFunctions.Domain.filter (fun {kind} -> DomainData.is_self kind) domain + |> TransferFunctions.Domain.choose_opt in match (weakSelf_opt, self_opt) with | Some {pvar= weakSelf; loc= weakLoc}, Some {pvar= self; loc= selfLoc} -> diff --git a/infer/tests/codetoanalyze/objc/self-in-block/StrongSelf.m b/infer/tests/codetoanalyze/objc/self-in-block/StrongSelf.m index f104efce7..86779d855 100644 --- a/infer/tests/codetoanalyze/objc/self-in-block/StrongSelf.m +++ b/infer/tests/codetoanalyze/objc/self-in-block/StrongSelf.m @@ -27,6 +27,7 @@ if (strongSelf) { [strongSelf foo]; int x = self->x; // bug here + [self foo]; } return 0; }; diff --git a/infer/tests/codetoanalyze/objc/self-in-block/issues.exp b/infer/tests/codetoanalyze/objc/self-in-block/issues.exp index b3407516b..e27ae9926 100644 --- a/infer/tests/codetoanalyze/objc/self-in-block/issues.exp +++ b/infer/tests/codetoanalyze/objc/self-in-block/issues.exp @@ -1 +1 @@ -codetoanalyze/objc/self-in-block/StrongSelf.m, objc_blockSelfInBlockTest::mixSelfWeakSelf_bad_1, 4, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [Using &weakSelf,Using &self] +codetoanalyze/objc/self-in-block/StrongSelf.m, objc_blockSelfInBlockTest::mixSelfWeakSelf_bad_1, 4, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [Using &weakSelf,Using &self,Using &self]