From bd166a244f078d34a55fe1f7df7dd9fd73f44a99 Mon Sep 17 00:00:00 2001 From: Mitya Lyubarskiy Date: Mon, 10 Feb 2020 05:29:51 -0800 Subject: [PATCH] [nullsafe][easy] fix the wrong comment about order of arguments in `instanceof` Summary: This was introduced in D19770219, and skcho caught it, but for some reason I seemed to have a blind spot and confused the semantics of `instanceof`. Reviewed By: skcho Differential Revision: D19813031 fbshipit-source-id: d939b981b --- infer/src/nullsafe/typeCheck.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/infer/src/nullsafe/typeCheck.ml b/infer/src/nullsafe/typeCheck.ml index e19fe1d46..76f328dd7 100644 --- a/infer/src/nullsafe/typeCheck.ml +++ b/infer/src/nullsafe/typeCheck.ml @@ -665,8 +665,8 @@ let rec check_condition_for_sil_prune tenv idenv calls_this find_canonical_dupli | _ -> None in - (* check if the expression is coming from (`a` instanceof `b`), and returns `b`, if it is the case *) - let extract_argument_from_instanceof expr = + (* check if the expression is coming from (`a` instanceof `b`), and returns `a`, if it is the case *) + let extract_first_argument_from_instanceof expr = match extract_arguments_from_call ComplexExpressions.procname_instanceof expr with | Some [argument; _] -> Some argument @@ -805,9 +805,9 @@ let rec check_condition_for_sil_prune tenv idenv calls_this find_canonical_dupli accumulated_typestate ) arguments | None -> ( - match extract_argument_from_instanceof expr with + match extract_first_argument_from_instanceof expr with | Some argument -> - (* ([argument] instanceof [expr] == true) implies (expr != null) *) + (* ([argument] instanceof == true) implies (argument != null) *) set_original_pvar_to_nonnull_in_typestate ~with_cond_redundant_check:false argument typestate | None ->