From cb3a657465ca8dd08a91ce309392d415d8cd3c20 Mon Sep 17 00:00:00 2001 From: Mitya Lyubarskiy Date: Mon, 9 Mar 2020 07:16:35 -0700 Subject: [PATCH] [nullsafe][refactor] Don't modify typestate without a need in Cast instruction Summary: Turns out, we did not need to update typestate here. Reviewed By: artempyanykh Differential Revision: D20285065 fbshipit-source-id: 0403d7acc --- infer/src/nullsafe/typeCheck.ml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/infer/src/nullsafe/typeCheck.ml b/infer/src/nullsafe/typeCheck.ml index 379282e73..c8ac37538 100644 --- a/infer/src/nullsafe/typeCheck.ml +++ b/infer/src/nullsafe/typeCheck.ml @@ -1147,15 +1147,15 @@ let typecheck_instr tenv calls_this checks (node : Procdesc.Node.t) idenv curr_p when Procname.equal pn BuiltinDecl.__cast -> typecheck_expr_for_errors ~nullsafe_mode find_canonical_duplicate curr_pdesc calls_this checks tenv node instr_ref typestate e loc ; - let e', typestate' = - convert_complex_exp_to_pvar_and_update_typestate tenv idenv curr_pname - curr_annotated_signature ~node ~original_node:node ~is_assignment:false e typestate loc + let e' = + convert_complex_exp_to_pvar tenv idenv curr_pname curr_annotated_signature ~node + ~original_node:node e typestate loc in (* cast copies the type of the first argument *) TypeState.add_id id (typecheck_expr_simple ~nullsafe_mode find_canonical_duplicate curr_pdesc calls_this checks - tenv node instr_ref typestate' e' typ TypeOrigin.OptimisticFallback loc) - typestate' ~descr:"type cast" + tenv node instr_ref typestate e' typ TypeOrigin.OptimisticFallback loc) + typestate ~descr:"type cast" (* myarray.length *) | Sil.Call ((id, _), Exp.Const (Const.Cfun pn), [(array_exp, t)], loc, _) when Procname.equal pn BuiltinDecl.__get_array_length ->