From a4a4b9269056224e3b16da96f48825a95bc0912e Mon Sep 17 00:00:00 2001 From: Mitya Lyubarskiy Date: Fri, 7 Feb 2020 02:17:07 -0800 Subject: [PATCH] [nullsafe][refactor] TypeState.ml cleanup: Remove uneccessary calls Summary: These two methods are called in processing prune instructions, when instruction is Prune(expr == null) and Prune(expr != null), to correctly infer nullability in corresponding branches. Typechecking underlying expr makes little sense for two reasons: 1. In practice, expr it is as simple as a temporary SIL variable 2. If the idea is defensively typecheck everything for case when SIL produces crazy expressions, well, that is not going to work: the code around ignores many other forms of expressions, e.g. everything where expr = . So this is inconsistent. This will simplify further cleanup, see follow up diffs Reviewed By: ngorogiannis Differential Revision: D19743826 fbshipit-source-id: 319a80ee7 --- infer/src/nullsafe/typeCheck.ml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/infer/src/nullsafe/typeCheck.ml b/infer/src/nullsafe/typeCheck.ml index bb78db8b3..16518334e 100644 --- a/infer/src/nullsafe/typeCheck.ml +++ b/infer/src/nullsafe/typeCheck.ml @@ -738,8 +738,6 @@ let rec check_condition_for_sil_prune tenv idenv calls_this find_canonical_dupli | Exp.BinOp (Binop.Eq, Exp.Const (Const.Cint i), e) | Exp.BinOp (Binop.Eq, e, Exp.Const (Const.Cint i)) when IntLit.iszero i -> ( - typecheck_expr_for_errors ~nullsafe_mode find_canonical_duplicate curr_pdesc calls_this checks - tenv original_node instr_ref typestate e loc ; let typestate1, e1, from_call = match from_is_true_on_null e with | Some e1 -> @@ -768,8 +766,6 @@ let rec check_condition_for_sil_prune tenv idenv calls_this find_canonical_dupli | Exp.BinOp (Binop.Ne, Exp.Const (Const.Cint i), e) | Exp.BinOp (Binop.Ne, e, Exp.Const (Const.Cint i)) when IntLit.iszero i -> ( - typecheck_expr_for_errors ~nullsafe_mode find_canonical_duplicate curr_pdesc calls_this checks - tenv original_node instr_ref typestate e loc ; let typestate1, e1, from_call = match from_instanceof e with | Some e1 ->