Remove unnecessary condition types
[hiphop-php.git] / hphp / hack / src / oxidized_by_ref / gen / decl_defs.rs
blob88089b26a315fb194bfacf0960da5f1ed64aa37e
1 // Copyright (c) Facebook, Inc. and its affiliates.
2 //
3 // This source code is licensed under the MIT license found in the
4 // LICENSE file in the "hack" directory of this source tree.
5 //
6 // @generated SignedSource<<cb5d2973128511517f229a63ef614cc7>>
7 //
8 // To regenerate this file, run:
9 //   hphp/hack/src/oxidized_regen.sh
11 use arena_trait::TrivialDrop;
12 use eq_modulo_pos::EqModuloPos;
13 use no_pos_hash::NoPosHash;
14 use ocamlrep_derive::FromOcamlRepIn;
15 use ocamlrep_derive::ToOcamlRep;
16 use serde::Deserialize;
17 use serde::Serialize;
19 #[allow(unused_imports)]
20 use crate::*;
22 pub use typing_defs::*;
24 /// A substitution context contains all the information necessary for
25 /// changing the type of an inherited class element to the class that is
26 /// inheriting the class element. It's best illustrated via an example.
27 ///
28 /// ```
29 /// class A<Ta1, Ta2> { public function test(Ta1 $x, Ta2 $y): void {} }
30 ///
31 /// class B<Tb> extends A<Tb, int> {}
32 ///
33 /// class C extends B<string> {}
34 /// ```
35 ///
36 /// The method `A::test()` has the type (function(Ta1, Ta2): void) in the
37 /// context of class A. However in the context of class B, it will have type
38 /// (function(Tb, int): void).
39 ///
40 /// The substitution that leads to this change is [Ta1 -> Tb, Ta2 -> int],
41 /// which will produce a new type in the context of class B. It's subst_context
42 /// would then be:
43 ///
44 /// ```
45 /// { sc_subst            = [Ta1 -> Tb, Ta2 -> int];
46 ///   sc_class_context    = 'B';
47 ///   sc_from_req_extends = false;
48 /// }
49 /// ```
50 ///
51 /// The `sc_from_req_extends` field is set to true if the context was inherited
52 /// via a require extends type. This information is relevant when folding
53 /// `dc_substs` during inheritance. See Decl_inherit module.
54 #[derive(
55     Clone,
56     Debug,
57     Deserialize,
58     Eq,
59     EqModuloPos,
60     FromOcamlRepIn,
61     Hash,
62     NoPosHash,
63     Ord,
64     PartialEq,
65     PartialOrd,
66     Serialize,
67     ToOcamlRep
69 #[repr(C)]
70 pub struct SubstContext<'a> {
71     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
72     pub subst: s_map::SMap<'a, &'a Ty<'a>>,
73     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
74     pub class_context: &'a str,
75     pub from_req_extends: bool,
77 impl<'a> TrivialDrop for SubstContext<'a> {}
78 arena_deserializer::impl_deserialize_in_arena!(SubstContext<'arena>);
80 pub use oxidized::decl_defs::SourceType;
82 pub use oxidized::decl_defs::LinearizationKind;
84 #[derive(
85     Clone,
86     Debug,
87     Deserialize,
88     Eq,
89     EqModuloPos,
90     FromOcamlRepIn,
91     Hash,
92     NoPosHash,
93     Ord,
94     PartialEq,
95     PartialOrd,
96     Serialize,
97     ToOcamlRep
99 #[repr(C)]
100 pub struct DeclClassType<'a> {
101     pub need_init: bool,
102     pub abstract_: bool,
103     pub final_: bool,
104     pub const_: bool,
105     pub internal: bool,
106     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
107     pub deferred_init_members: s_set::SSet<'a>,
108     pub kind: oxidized::ast_defs::ClassishKind,
109     pub is_xhp: bool,
110     pub has_xhp_keyword: bool,
111     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
112     pub module: Option<ast_defs::Id<'a>>,
113     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
114     pub name: &'a str,
115     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
116     pub pos: &'a pos_or_decl::PosOrDecl<'a>,
117     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
118     pub tparams: &'a [&'a Tparam<'a>],
119     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
120     pub where_constraints: &'a [&'a WhereConstraint<'a>],
121     /// class name to the subst_context that must be applied to that class
122     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
123     pub substs: s_map::SMap<'a, &'a SubstContext<'a>>,
124     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
125     pub consts: s_map::SMap<'a, &'a ClassConst<'a>>,
126     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
127     pub typeconsts: s_map::SMap<'a, &'a TypeconstType<'a>>,
128     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
129     pub props: s_map::SMap<'a, &'a Element<'a>>,
130     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
131     pub sprops: s_map::SMap<'a, &'a Element<'a>>,
132     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
133     pub methods: s_map::SMap<'a, &'a Element<'a>>,
134     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
135     pub smethods: s_map::SMap<'a, &'a Element<'a>>,
136     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
137     pub construct: (Option<&'a Element<'a>>, ConsistentKind),
138     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
139     pub ancestors: s_map::SMap<'a, &'a Ty<'a>>,
140     pub support_dynamic_type: bool,
141     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
142     pub req_ancestors: &'a [&'a Requirement<'a>],
143     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
144     pub req_ancestors_extends: s_set::SSet<'a>,
145     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
146     pub extends: s_set::SSet<'a>,
147     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
148     pub sealed_whitelist: Option<s_set::SSet<'a>>,
149     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
150     pub xhp_attr_deps: s_set::SSet<'a>,
151     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
152     pub xhp_enum_values: s_map::SMap<'a, &'a [ast_defs::XhpEnumValue<'a>]>,
153     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
154     pub enum_type: Option<&'a EnumType<'a>>,
155     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
156     pub decl_errors: Option<&'a errors::Errors<'a>>,
158 impl<'a> TrivialDrop for DeclClassType<'a> {}
159 arena_deserializer::impl_deserialize_in_arena!(DeclClassType<'arena>);
161 #[derive(
162     Clone,
163     Debug,
164     Deserialize,
165     Eq,
166     EqModuloPos,
167     FromOcamlRepIn,
168     Hash,
169     NoPosHash,
170     Ord,
171     PartialEq,
172     PartialOrd,
173     Serialize,
174     ToOcamlRep
176 #[repr(C)]
177 pub struct Element<'a> {
178     pub flags: typing_defs_flags::class_elt::ClassElt,
179     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
180     pub origin: &'a str,
181     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
182     pub visibility: CeVisibility<'a>,
183     #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
184     pub deprecated: Option<&'a str>,
186 impl<'a> TrivialDrop for Element<'a> {}
187 arena_deserializer::impl_deserialize_in_arena!(Element<'arena>);