From 39aca6326c902757770c8b102b14a35cd77312ad Mon Sep 17 00:00:00 2001 From: Mitya Lyubarskiy Date: Wed, 18 Sep 2019 02:58:25 -0700 Subject: [PATCH] [nullsafe] Remove old traces of modelling the annotation for the field Summary: We historically had Model.Inference, which was an attempt to enhance models with additional abilities to get the annotation. This feature got removed in D9805110, including removing of the key condition Models.Inference.field_is_marked. This code also is not executed: `Config.eradicate` condition was an old artefact of migrating Eradicate to callback infrastructure: D1508451. We run eradicate only as a callback as of now, so this flag is always true. In follow up diffs we refactor AnnotationSignature module, and this cleanup simplifies the refactoring. Reviewed By: ngorogiannis Differential Revision: D17419173 fbshipit-source-id: 1b30555de --- infer/src/nullsafe/AnnotatedSignature.mli | 3 --- infer/src/nullsafe/eradicateChecks.ml | 12 +----------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/infer/src/nullsafe/AnnotatedSignature.mli b/infer/src/nullsafe/AnnotatedSignature.mli index 62e87eb49..e81bb201c 100644 --- a/infer/src/nullsafe/AnnotatedSignature.mli +++ b/infer/src/nullsafe/AnnotatedSignature.mli @@ -23,8 +23,5 @@ val mark_nullability : Typ.Procname.t -> t -> bool * bool list -> t val get : ProcAttributes.t -> t (** Get a method signature with annotations from a proc_attributes. *) -val mk_ia_nullable : Annot.Item.t -> Annot.Item.t -(** Add the nullable annotation to the item_annotation, if not already present. *) - val pp : Typ.Procname.t -> Format.formatter -> t -> unit (** Pretty print a method signature with annotations. *) diff --git a/infer/src/nullsafe/eradicateChecks.ml b/infer/src/nullsafe/eradicateChecks.ml index 186c68a10..2615cbe3a 100644 --- a/infer/src/nullsafe/eradicateChecks.ml +++ b/infer/src/nullsafe/eradicateChecks.ml @@ -11,17 +11,7 @@ open! IStd let get_field_annotation tenv fn typ = let lookup = Tenv.lookup tenv in - match Typ.Struct.get_field_type_and_annotation ~lookup fn typ with - | None -> - None - | Some (t, ia) -> - let ia' = - (* TODO (t4968422) eliminate not !Config.eradicate check by marking fields as nullified *) - (* outside of Eradicate in some other way *) - if not Config.eradicate then AnnotatedSignature.mk_ia_nullable ia else ia - in - Some (t, ia') - + Typ.Struct.get_field_type_and_annotation ~lookup fn typ let report_error tenv = TypeErr.report_error tenv (EradicateCheckers.report_error tenv)