[infer][eradicate] no longer modify the attributes in the summary

Summary: This does not seem to be used anymore. If we happen to need this, we should update the payload, not the attributes.

Reviewed By: jberdine

Differential Revision: D6321824

fbshipit-source-id: 5c19359
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent 2b0335f32b
commit 52dca67de9

@ -45,16 +45,10 @@ module MkCallback (Extension : ExtensionT) : CallBackT = struct
match Specs.get_summary proc_name with match Specs.get_summary proc_name with
| Some old_summ -> | Some old_summ ->
let nodes = List.map ~f:(fun n -> Procdesc.Node.get_id n) (Procdesc.get_nodes proc_desc) in let nodes = List.map ~f:(fun n -> Procdesc.Node.get_id n) (Procdesc.get_nodes proc_desc) in
let method_annotation =
(Specs.pdesc_resolve_attributes proc_desc).ProcAttributes.method_annotation
in
let new_summ = let new_summ =
{ old_summ with { old_summ with
Specs.nodes Specs.nodes
; Specs.payload= Extension.update_payload final_typestate_opt old_summ.Specs.payload ; Specs.payload= Extension.update_payload final_typestate_opt old_summ.Specs.payload }
; Specs.attributes=
{ old_summ.Specs.attributes with
ProcAttributes.loc= Procdesc.get_loc proc_desc; method_annotation } }
in in
Specs.add_summary proc_name new_summ Specs.add_summary proc_name new_summ
| None -> | None ->
@ -398,4 +392,3 @@ let callback_check_return_type check_return_type callback_args =
{TypeCheck.eradicate= false; check_extension= false; check_ret_type= [check_return_type]} {TypeCheck.eradicate= false; check_extension= false; check_ret_type= [check_return_type]}
in in
Main.callback checks callback_args Main.callback checks callback_args

@ -295,25 +295,6 @@ let check_constructor_initialization tenv find_canonical_duplicate curr_pname cu
() ()
(** Make the return type @Nullable by modifying the spec. *)
let spec_make_return_nullable curr_pname =
match Specs.get_summary curr_pname with
| Some summary ->
let proc_attributes = Specs.get_attributes summary in
let method_annotation = proc_attributes.ProcAttributes.method_annotation in
let method_annotation' =
AnnotatedSignature.method_annotation_mark_return AnnotatedSignature.Nullable
method_annotation
in
let proc_attributes' =
{proc_attributes with ProcAttributes.method_annotation= method_annotation'}
in
let summary' = {summary with Specs.attributes= proc_attributes'} in
Specs.add_summary curr_pname summary'
| None ->
()
(** Check the annotations when returning from a method. *) (** Check the annotations when returning from a method. *)
let check_return_annotation tenv find_canonical_duplicate curr_pdesc ret_range let check_return_annotation tenv find_canonical_duplicate curr_pdesc ret_range
(annotated_signature: AnnotatedSignature.t) ret_implicitly_nullable loc : unit = (annotated_signature: AnnotatedSignature.t) ret_implicitly_nullable loc : unit =
@ -348,8 +329,6 @@ let check_return_annotation tenv find_canonical_duplicate curr_pdesc ret_range
in in
if return_not_nullable && Models.Inference.enabled then if return_not_nullable && Models.Inference.enabled then
Models.Inference.proc_mark_return_nullable curr_pname ; Models.Inference.proc_mark_return_nullable curr_pname ;
if return_not_nullable && Config.eradicate_propagate_return_nullable then
spec_make_return_nullable curr_pname ;
( if return_not_nullable || return_value_not_present then ( if return_not_nullable || return_value_not_present then
let ann = let ann =
if return_not_nullable then AnnotatedSignature.Nullable else AnnotatedSignature.Present if return_not_nullable then AnnotatedSignature.Nullable else AnnotatedSignature.Present
@ -494,4 +473,3 @@ let check_overridden_annotations find_canonical_duplicate tenv proc_name proc_de
() ()
in in
PatternMatch.override_iter check tenv proc_name PatternMatch.override_iter check tenv proc_name

Loading…
Cancel
Save