2 * Copyright (c) Facebook, Inc. and its affiliates.
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the "hack" directory of this source tree.
10 module SN
= Naming_special_names
13 base
: Typing_defs.decl_ty
;
14 (** Underlying type of the enum, e.g. int or string.
15 For subclasses of Enum, this is the type parameter of Enum.
16 For enum classes, this is HH\MemberOf<E, I>. *)
17 type_
: Typing_defs.decl_ty
;
18 (** Type containing the enum name.
19 For subclasses of Enum, this is also the type parameter of Enum. *)
20 constraint_
: Typing_defs.decl_ty
option;
21 (** Reflects what's after the [as] keyword in the enum definition. *)
22 interface
: Typing_defs.decl_ty
option;
23 (** For enum classes, this is the raw interface I, as provided by the user. *)
26 (** Figures out if a class needs to be treated like an enum. *)
30 Typing_defs.enum_type
option ->
31 Typing_defs.decl_ty
option ->
32 get_ancestor
:(string -> Typing_defs.decl_phase
Typing_defs.ty
option) ->
35 (** If a class is an Enum, we give all of the constants in the class the type
36 of the Enum. We don't do this for Enum<mixed> and Enum<arraykey>, since
37 that could *lose* type information. *)
41 Typing_defs.enum_type
option ->
42 Typing_defs.decl_ty
option ->
43 get_ancestor
:(string -> Typing_defs.decl_phase
Typing_defs.ty
option) ->
44 Typing_defs.class_const
SMap.t
->
45 Typing_defs.class_const
SMap.t
47 (** Same as [rewrite_class], but for use when shallow_class_decl is enabled *)
48 val rewrite_class_consts
:
50 (string * Typing_defs.class_const
) Sequence.t
->
51 (string * Typing_defs.class_const
) Sequence.t