From 52dca67de9419f3a9dbdc00da00081773081d863 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Tue, 14 Nov 2017 23:26:24 -0800 Subject: [PATCH] [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 --- infer/src/eradicate/eradicate.ml | 9 +-------- infer/src/eradicate/eradicateChecks.ml | 22 ---------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/infer/src/eradicate/eradicate.ml b/infer/src/eradicate/eradicate.ml index 5f95fda5a..a30e759b7 100644 --- a/infer/src/eradicate/eradicate.ml +++ b/infer/src/eradicate/eradicate.ml @@ -45,16 +45,10 @@ module MkCallback (Extension : ExtensionT) : CallBackT = struct match Specs.get_summary proc_name with | Some old_summ -> 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 = { old_summ with Specs.nodes - ; 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 } } + ; Specs.payload= Extension.update_payload final_typestate_opt old_summ.Specs.payload } in Specs.add_summary proc_name new_summ | 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]} in Main.callback checks callback_args - diff --git a/infer/src/eradicate/eradicateChecks.ml b/infer/src/eradicate/eradicateChecks.ml index a4d2e9430..36d796844 100644 --- a/infer/src/eradicate/eradicateChecks.ml +++ b/infer/src/eradicate/eradicateChecks.ml @@ -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. *) let check_return_annotation tenv find_canonical_duplicate curr_pdesc ret_range (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 if return_not_nullable && Models.Inference.enabled then 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 let ann = 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 PatternMatch.override_iter check tenv proc_name -