[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
master
Mitya Lyubarskiy 5 years ago committed by Facebook Github Bot
parent e3a5906f7a
commit cb3a657465

@ -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 ->

Loading…
Cancel
Save