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

@ -665,8 +665,8 @@ let rec check_condition_for_sil_prune tenv idenv calls_this find_canonical_dupli
| _ -> | _ ->
None None
in in
(* check if the expression is coming from (`a` instanceof `b`), and returns `b`, if it is the case *) (* check if the expression is coming from (`a` instanceof `b`), and returns `a`, if it is the case *)
let extract_argument_from_instanceof expr = let extract_first_argument_from_instanceof expr =
match extract_arguments_from_call ComplexExpressions.procname_instanceof expr with match extract_arguments_from_call ComplexExpressions.procname_instanceof expr with
| Some [argument; _] -> | Some [argument; _] ->
Some argument Some argument
@ -805,9 +805,9 @@ let rec check_condition_for_sil_prune tenv idenv calls_this find_canonical_dupli
accumulated_typestate ) accumulated_typestate )
arguments arguments
| None -> ( | None -> (
match extract_argument_from_instanceof expr with match extract_first_argument_from_instanceof expr with
| Some argument -> | Some argument ->
(* ([argument] instanceof [expr] == true) implies (expr != null) *) (* ([argument] instanceof <anything> == true) implies (argument != null) *)
set_original_pvar_to_nonnull_in_typestate ~with_cond_redundant_check:false argument set_original_pvar_to_nonnull_in_typestate ~with_cond_redundant_check:false argument
typestate typestate
| None -> | None ->

Loading…
Cancel
Save