1 // Copyright (c) Facebook, Inc. and its affiliates.
3 // This source code is licensed under the MIT license found in the
4 // LICENSE file in the "hack" directory of this source tree.
6 // @generated SignedSource<<cb5d2973128511517f229a63ef614cc7>>
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;
19 #[allow(unused_imports)]
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.
29 /// class A<Ta1, Ta2> { public function test(Ta1 $x, Ta2 $y): void {} }
31 /// class B<Tb> extends A<Tb, int> {}
33 /// class C extends B<string> {}
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).
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
45 /// { sc_subst = [Ta1 -> Tb, Ta2 -> int];
46 /// sc_class_context = 'B';
47 /// sc_from_req_extends = false;
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.
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;
100 pub struct DeclClassType<'a> {
106 #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
107 pub deferred_init_members: s_set::SSet<'a>,
108 pub kind: oxidized::ast_defs::ClassishKind,
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)]
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>);
177 pub struct Element<'a> {
178 pub flags: typing_defs_flags::class_elt::ClassElt,
179 #[serde(deserialize_with = "arena_deserializer::arena", borrow)]
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>);