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<<a38d9ba2a4cbdbfa37d5f352de46503e>>
8 // To regenerate this file, run:
9 // hphp/hack/src/oxidized/regen.sh
11 use ocamlrep_derive::OcamlRep;
12 use ocamlvalue_macro::Ocamlvalue;
23 use crate::tany_sentinel;
25 pub use crate::typing_reason as reason;
27 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
34 #[derive(Clone, Copy, Debug, Eq, OcamlRep, Ocamlvalue, PartialEq)]
40 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
46 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
47 pub struct Ty(pub reason::Reason, pub Box<Ty_>);
51 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
52 pub struct ShapeFieldType {
57 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
60 Tapply(nast::Sid, Vec<DeclTy>),
63 Tarray(Option<DeclTy>, Option<DeclTy>),
64 Tdarray(DeclTy, DeclTy),
66 TvarrayOrDarray(DeclTy),
70 Tany(tany_sentinel::TanySentinel),
78 Tshape(ShapeKind, nast::shape_map::ShapeMap<ShapeFieldType>),
79 TpuAccess(Ty, nast::Sid),
83 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
84 pub enum DependentType {
90 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
91 pub struct TaccessType(pub DeclTy, pub Vec<nast::Sid>);
93 #[derive(Clone, Copy, Debug, Eq, OcamlRep, Ocamlvalue, PartialEq)]
99 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
100 pub enum Reactivity {
102 Local(Option<DeclTy>),
103 Shallow(Option<DeclTy>),
104 Reactive(Option<DeclTy>),
105 MaybeReactive(Box<Reactivity>),
106 RxVar(Option<Box<Reactivity>>),
109 #[derive(Clone, Copy, Debug, Eq, OcamlRep, Ocamlvalue, PartialEq)]
116 #[derive(Clone, Copy, Debug, Eq, OcamlRep, Ocamlvalue, PartialEq)]
117 pub enum ParamMutability {
119 ParamBorrowedMutable,
123 #[derive(Clone, Copy, Debug, Eq, OcamlRep, Ocamlvalue, PartialEq)]
124 pub enum FunTparamsKind {
126 FTKinstantiatedTargs,
129 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
130 pub struct FunType<Ty> {
132 pub deprecated: Option<String>,
133 pub is_coroutine: bool,
134 pub arity: FunArity<Ty>,
135 pub tparams: (Vec<Tparam<Ty>>, FunTparamsKind),
136 pub where_constraints: Vec<WhereConstraint<Ty>>,
137 pub params: FunParams<Ty>,
138 pub ret: PossiblyEnforcedTy<Ty>,
139 pub fun_kind: ast_defs::FunKind,
140 pub reactive: Reactivity,
141 pub return_disposable: bool,
142 pub mutability: Option<ParamMutability>,
143 pub returns_mutable: bool,
144 pub decl_errors: Option<errors::Errors>,
145 pub returns_void_to_rx: bool,
148 pub type DeclFunType = FunType<DeclTy>;
150 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
151 pub enum FunArity<Ty> {
152 Fstandard(isize, isize),
153 Fvariadic(isize, FunParam<Ty>),
154 Fellipsis(isize, pos::Pos),
157 pub type DeclFunArity = FunArity<DeclTy>;
159 #[derive(Clone, Copy, Debug, Eq, OcamlRep, Ocamlvalue, PartialEq)]
166 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
167 pub enum ParamRxAnnotation {
169 ParamRxIfImpl(DeclTy),
172 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
173 pub struct PossiblyEnforcedTy<Ty> {
178 pub type DeclPossiblyEnforcedTy = PossiblyEnforcedTy<DeclTy>;
180 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
181 pub struct FunParam<Ty> {
183 pub name: Option<String>,
184 pub type_: PossiblyEnforcedTy<Ty>,
186 pub accept_disposable: bool,
187 pub mutability: Option<ParamMutability>,
188 pub rx_annotation: Option<ParamRxAnnotation>,
191 pub type DeclFunParam = FunParam<DeclTy>;
193 pub type FunParams<Ty> = Vec<FunParam<Ty>>;
195 pub type DeclFunParams = FunParams<DeclTy>;
197 #[derive(Clone, Copy, Debug, Eq, OcamlRep, Ocamlvalue, PartialEq)]
198 pub enum XhpAttrTag {
203 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
205 pub tag: Option<XhpAttrTag>,
206 pub has_default: bool,
209 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
210 pub struct ClassElt {
213 pub xhp_attr: Option<XhpAttr>,
216 pub memoizelsb: bool,
217 pub synthesized: bool,
218 pub visibility: Visibility,
221 pub type_: lazy::Lazy<DeclTy>,
225 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
226 pub struct ClassConst {
227 pub synthesized: bool,
231 pub visibility: Visibility,
232 pub expr: Option<nast::Expr>,
236 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
237 pub struct Requirement(pub pos::Pos, pub DeclTy);
239 #[derive(Clone, Copy, Debug, Eq, OcamlRep, Ocamlvalue, PartialEq)]
240 pub enum ConsistentKind {
246 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
247 pub struct ClassType {
249 pub members_fully_known: bool,
254 pub deferred_init_members: s_set::SSet,
255 pub kind: ast_defs::ClassKind,
257 pub is_disposable: bool,
260 pub tparams: Vec<DeclTparam>,
261 pub where_constraints: Vec<DeclWhereConstraint>,
262 pub consts: s_map::SMap<ClassConst>,
263 pub typeconsts: s_map::SMap<TypeconstType>,
264 pub pu_enums: s_map::SMap<PuEnumType>,
265 pub props: s_map::SMap<ClassElt>,
266 pub sprops: s_map::SMap<ClassElt>,
267 pub methods: s_map::SMap<ClassElt>,
268 pub smethods: s_map::SMap<ClassElt>,
269 pub construct: (Option<ClassElt>, ConsistentKind),
270 pub ancestors: s_map::SMap<DeclTy>,
271 pub req_ancestors: Vec<Requirement>,
272 pub req_ancestors_extends: s_set::SSet,
273 pub extends: s_set::SSet,
274 pub enum_type: Option<EnumType>,
275 pub sealed_whitelist: Option<s_set::SSet>,
276 pub decl_errors: Option<errors::Errors>,
279 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
280 pub enum TypeconstAbstractKind {
281 TCAbstract(Option<DeclTy>),
286 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
287 pub struct TypeconstType {
288 pub abstract_: TypeconstAbstractKind,
289 pub visibility: Visibility,
291 pub constraint: Option<DeclTy>,
292 pub type_: Option<DeclTy>,
294 pub enforceable: (pos::Pos, bool),
295 pub reifiable: Option<pos::Pos>,
298 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
299 pub struct PuEnumType {
302 pub case_types: s_map::SMap<nast::Sid>,
303 pub case_values: s_map::SMap<(nast::Sid, DeclTy)>,
304 pub members: s_map::SMap<PuMemberType>,
307 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
308 pub struct PuMemberType {
310 pub types: s_map::SMap<(nast::Sid, DeclTy)>,
313 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
314 pub struct EnumType {
316 pub constraint: Option<DeclTy>,
319 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
320 pub struct TypedefType {
322 pub vis: aast::TypedefVisibility,
323 pub tparams: Vec<DeclTparam>,
324 pub constraint: Option<DeclTy>,
326 pub decl_errors: Option<errors::Errors>,
329 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
330 pub struct Tparam<Ty> {
331 pub variance: ast_defs::Variance,
332 pub name: ast_defs::Id,
333 pub constraints: Vec<(ast_defs::ConstraintKind, Ty)>,
334 pub reified: aast::ReifyKind,
335 pub user_attributes: Vec<nast::UserAttribute>,
338 pub type DeclTparam = Tparam<DeclTy>;
340 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
341 pub struct WhereConstraint<Ty>(pub Ty, pub ast_defs::ConstraintKind, pub Ty);
343 pub type DeclWhereConstraint = WhereConstraint<DeclTy>;
345 #[derive(Clone, Debug, OcamlRep, Ocamlvalue)]
346 pub enum DeserializationError {
348 NotSupported(String),
349 DeserializationError(String),