From 768d6e4f3d15bebd6e005a883e93c65ec4721a39 Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Tue, 3 Oct 2017 12:07:06 -0700 Subject: [PATCH] [thread-safety] better error message for actuals/formals mismatch Reviewed By: jeremydubreil Differential Revision: D5965852 fbshipit-source-id: 6bedcca --- infer/src/checkers/ThreadSafety.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index 708f7b598..d6bcb622e 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -700,7 +700,14 @@ module TransferFunctions (CFG : ProcCfg.S) = struct | AccessPrecondition.Unprotected formal_indexes -> IntSet.fold (fun index acc -> - add_ownership_access callee_accesses (List.nth_exn actuals index) acc) + match List.nth actuals index with + | Some actual + -> add_ownership_access callee_accesses actual acc + | None + -> L.internal_error + "Bad actual index %d for callee %a with %d actuals." index + Typ.Procname.pp callee_pname (List.length actuals) ; + acc) formal_indexes accesses_acc in AccessDomain.fold update_accesses accesses astate.accesses