From b36558d81e57114df381b6625d2623110d4e7ceb Mon Sep 17 00:00:00 2001 From: Thomas Jiang Date: Wed, 9 Mar 2022 13:52:59 -0800 Subject: [PATCH] Remove unnecessary condition types Summary: This field in the folded decl was added a while ago in D7377362 (https://github.com/facebook/hhvm/commit/b1b0146a0144184ff645c0be5776d6e68d7d8cd3) and since then has not seen use. As a result, remove it. Reviewed By: shayne-fletcher Differential Revision: D34730642 fbshipit-source-id: 821893f2fa09a59d7760088b375401675699fbfe --- hphp/hack/src/decl/decl_defs.ml | 3 --- hphp/hack/src/decl/decl_folded_class.ml | 16 +++++++--------- hphp/hack/src/decl/decl_pos_utils.ml | 1 - hphp/hack/src/decl/decl_redecl_service.ml | 2 -- hphp/hack/src/oxidized/gen/decl_defs.rs | 5 +---- hphp/hack/src/oxidized_by_ref/gen/decl_defs.rs | 6 +----- hphp/hack/src/rupro/lib/decl_defs/to_oxidized.rs | 1 - 7 files changed, 9 insertions(+), 25 deletions(-) diff --git a/hphp/hack/src/decl/decl_defs.ml b/hphp/hack/src/decl/decl_defs.ml index d7555264b50..a7eef3fce8f 100644 --- a/hphp/hack/src/decl/decl_defs.ml +++ b/hphp/hack/src/decl/decl_defs.ml @@ -189,9 +189,6 @@ type decl_class_type = { dc_xhp_enum_values: Ast_defs.xhp_enum_value list SMap.t; dc_enum_type: enum_type option; dc_decl_errors: Errors.t option; [@opaque] - dc_condition_types: SSet.t; - (** this field is used to prevent condition types being filtered - in Decl_redecl_service.is_dependent_class_of_any *) } [@@deriving show] diff --git a/hphp/hack/src/decl/decl_folded_class.ml b/hphp/hack/src/decl/decl_folded_class.ml index 3f57d6c5ae5..83494beb61c 100644 --- a/hphp/hack/src/decl/decl_folded_class.ml +++ b/hphp/hack/src/decl/decl_folded_class.ml @@ -694,10 +694,9 @@ let method_decl_eager ~(ctx : Provider_context.t) ~(is_static : bool) (c : Shallow_decl_defs.shallow_class) - ((acc, condition_types) : - (Decl_defs.element * Typing_defs.fun_elt option) SMap.t * SSet.t) + (acc : (Decl_defs.element * Typing_defs.fun_elt option) SMap.t) (m : Shallow_decl_defs.shallow_method) : - (Decl_defs.element * Typing_defs.fun_elt option) SMap.t * SSet.t = + (Decl_defs.element * Typing_defs.fun_elt option) SMap.t = (* If method doesn't override anything but has the <<__Override>> attribute, then * set the override flag in ce_flags and let typing emit an appropriate error *) let superfluous_override = @@ -735,7 +734,7 @@ let method_decl_eager in let fe = build_method_fun_elt ~ctx ~is_static ~elt_origin:elt.elt_origin m in let acc = SMap.add id (elt, Some fe) acc in - (acc, condition_types) + acc let method_decl_lazy ~(sh : SharedMem.uses) @@ -843,10 +842,10 @@ and class_decl List.fold_left ~f:(prop_decl_eager ~ctx c) ~init:props c.sc_props in let inherited_methods = inherited.Decl_inherit.ih_methods in - let (methods, condition_types) = + let methods = List.fold_left ~f:(method_decl_eager ~ctx ~is_static:false c) - ~init:(inherited_methods, SSet.empty) + ~init:inherited_methods c.sc_methods in let consts = inherited.Decl_inherit.ih_consts in @@ -874,11 +873,11 @@ and class_decl List.fold_left c.sc_sprops ~f:sclass_var ~init:inherited_static_props in let inherited_static_methods = inherited.Decl_inherit.ih_smethods in - let (static_methods, condition_types) = + let static_methods = List.fold_left c.sc_static_methods ~f:(method_decl_eager ~ctx ~is_static:true c) - ~init:(inherited_static_methods, condition_types) + ~init:inherited_static_methods in let parent_cstr = inherited.Decl_inherit.ih_cstr in let cstr = constructor_decl_eager ~sh ~ctx parent_cstr c in @@ -990,7 +989,6 @@ and class_decl dc_req_ancestors_extends = req_ancestors_extends; dc_enum_type = enum; dc_decl_errors = None; - dc_condition_types = condition_types; } in let member_heaps_values = diff --git a/hphp/hack/src/decl/decl_pos_utils.ml b/hphp/hack/src/decl/decl_pos_utils.ml index e135ed1757b..56e271b2613 100644 --- a/hphp/hack/src/decl/decl_pos_utils.ml +++ b/hphp/hack/src/decl/decl_pos_utils.ml @@ -281,7 +281,6 @@ struct dc_support_dynamic_type = dc.dc_support_dynamic_type; dc_enum_type = Option.map dc.dc_enum_type ~f:enum_type; dc_decl_errors = None; - dc_condition_types = dc.dc_condition_types; } and requirement (p, t) = (pos_or_decl p, ty t) diff --git a/hphp/hack/src/decl/decl_redecl_service.ml b/hphp/hack/src/decl/decl_redecl_service.ml index 3545d1d13d6..937cf238c34 100644 --- a/hphp/hack/src/decl/decl_redecl_service.ml +++ b/hphp/hack/src/decl/decl_redecl_service.ml @@ -370,9 +370,7 @@ let is_dependent_class_of_any ctx classes (c : string) : bool = SMap.exists c.Decl_defs.dc_ancestors ~f:(fun c _ -> SSet.mem classes c) || intersection_nonempty c.Decl_defs.dc_extends classes || intersection_nonempty c.Decl_defs.dc_xhp_attr_deps classes - || intersection_nonempty c.Decl_defs.dc_condition_types classes || intersection_nonempty c.Decl_defs.dc_req_ancestors_extends classes - || intersection_nonempty c.Decl_defs.dc_condition_types classes let get_maybe_dependent_classes (get_classes : Relative_path.t -> SSet.t) diff --git a/hphp/hack/src/oxidized/gen/decl_defs.rs b/hphp/hack/src/oxidized/gen/decl_defs.rs index 55086b7951a..0a486dacfb4 100644 --- a/hphp/hack/src/oxidized/gen/decl_defs.rs +++ b/hphp/hack/src/oxidized/gen/decl_defs.rs @@ -3,7 +3,7 @@ // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // -// @generated SignedSource<<22270168b938cd32b159fe155d0e6a0d>> +// @generated SignedSource<> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh @@ -180,9 +180,6 @@ pub struct DeclClassType { pub xhp_enum_values: s_map::SMap>, pub enum_type: Option, pub decl_errors: Option, - /// this field is used to prevent condition types being filtered - /// in Decl_redecl_service.is_dependent_class_of_any - pub condition_types: s_set::SSet, } #[derive( diff --git a/hphp/hack/src/oxidized_by_ref/gen/decl_defs.rs b/hphp/hack/src/oxidized_by_ref/gen/decl_defs.rs index 3e061db89a6..88089b26a31 100644 --- a/hphp/hack/src/oxidized_by_ref/gen/decl_defs.rs +++ b/hphp/hack/src/oxidized_by_ref/gen/decl_defs.rs @@ -3,7 +3,7 @@ // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // -// @generated SignedSource<> +// @generated SignedSource<> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh @@ -154,10 +154,6 @@ pub struct DeclClassType<'a> { pub enum_type: Option<&'a EnumType<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub decl_errors: Option<&'a errors::Errors<'a>>, - /// this field is used to prevent condition types being filtered - /// in Decl_redecl_service.is_dependent_class_of_any - #[serde(deserialize_with = "arena_deserializer::arena", borrow)] - pub condition_types: s_set::SSet<'a>, } impl<'a> TrivialDrop for DeclClassType<'a> {} arena_deserializer::impl_deserialize_in_arena!(DeclClassType<'arena>); diff --git a/hphp/hack/src/rupro/lib/decl_defs/to_oxidized.rs b/hphp/hack/src/rupro/lib/decl_defs/to_oxidized.rs index 7fe34c780e3..66404292819 100644 --- a/hphp/hack/src/rupro/lib/decl_defs/to_oxidized.rs +++ b/hphp/hack/src/rupro/lib/decl_defs/to_oxidized.rs @@ -394,7 +394,6 @@ impl<'a, R: Reason> ToOxidized<'a> for folded::FoldedClass { xhp_attr_deps: SSet::empty(), enum_type: None, decl_errors: None, - condition_types: SSet::empty(), } } } -- 2.11.4.GIT