Typing changes for reactive functions
[hiphop-php.git] / hphp / hack / src / typing / typing_env.mli
blobb599caee4f8d442941347e8434f2065d90287bc5
1 (**
2 * Copyright (c) 2015, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the "hack" directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
9 *)
10 include Typing_env_types_sig.S
12 open Typing_defs
13 open Typing_heap
15 val get_tcopt : env -> TypecheckerOptions.t
16 val fresh : unit -> int
17 val fresh_type : unit -> locl ty
18 val fresh_unresolved_type : env -> env * locl ty
19 val add_subst : env -> int -> int -> env
20 val get_var : env -> int -> env * int
21 val rename : env -> int -> int -> env
22 val add : env -> int -> locl ty -> env
23 val get_type : env -> Reason.t -> int -> env * locl ty
24 val get_type_unsafe : env -> int -> env * locl ty
25 val expand_type : env -> locl ty -> env * locl ty
26 val make_ft : Pos.t -> bool -> bool -> decl fun_params -> decl ty -> decl fun_type
27 val get_shape_field_name : Nast.shape_field_name -> string
28 val empty_fake_members : fake_members
29 val empty_local : tpenv -> local_env
30 val empty : TypecheckerOptions.t -> Relative_path.t ->
31 droot: Typing_deps.Dep.variant option -> env
32 val is_typedef : Typedefs.key -> bool
33 val get_enum : env -> Classes.key -> Classes.t option
34 val is_enum : env -> Classes.key -> bool
35 val get_enum_constraint : env -> Classes.key -> decl ty option
36 val add_wclass : env -> string -> unit
37 val fresh_tenv : env -> (env -> 'a) -> 'a
38 val get_class : env -> Classes.key -> Classes.t option
39 val get_typedef : env -> Typedefs.key -> Typedefs.t option
40 val get_const : env -> class_type -> string -> class_const option
41 val get_typeconst : env -> class_type -> string -> typeconst_type option
42 val get_gconst : env -> GConsts.key -> GConsts.t option
43 val get_static_member : bool -> env -> class_type -> string -> class_elt option
44 val suggest_static_member :
45 bool -> class_type -> string -> (Pos.t * string) option
46 val get_member : bool -> env -> class_type -> string -> class_elt option
47 val suggest_member : bool -> class_type -> string -> (Pos.t * string) option
48 val get_construct : env -> class_type -> class_elt option * bool
49 val check_todo : env -> env
50 val get_return : env -> locl ty * bool (* Use as contextual type *)
51 val set_return : env -> locl ty * bool -> env
52 val get_params : env -> (locl ty * param_mode) Local_id.Map.t
53 val set_param : env -> Local_id.t -> locl ty * param_mode -> env
54 val clear_params : env -> env
55 val with_env : env -> (env -> env * 'a) -> env * 'a
56 val is_static : env -> bool
57 val get_self : env -> locl ty
58 val get_self_id : env -> string
59 val is_outside_class : env -> bool
60 val get_parent_id : env -> string
61 val get_parent : env -> decl ty
62 val get_fn_kind : env -> Ast.fun_kind
63 val get_file : env -> Relative_path.t
64 val get_fun : env -> Funs.key -> Funs.t option
65 val set_fn_kind : env -> Ast.fun_kind -> env
66 val add_todo : env -> tfun -> env
67 val add_anonymous : env -> anon -> env * int
68 val set_anonymous : env -> int -> anon -> env
69 val get_anonymous : env -> int -> anon option
70 val set_self_id : env -> string -> env
71 val set_self : env -> locl ty -> env
72 val set_parent_id : env -> string -> env
73 val set_parent : env -> decl ty -> env
74 val set_static : env -> env
75 val set_mode : env -> FileInfo.mode -> env
76 val get_mode : env -> FileInfo.mode
77 val is_strict : env -> bool
78 val is_decl : env -> bool
79 val get_options: env -> TypecheckerOptions.t
80 val get_last_call : env -> Pos.t
81 val lost_info : string -> env -> locl ty -> env * locl ty
82 val forget_members : env -> Pos.t -> env
83 module FakeMembers :
84 sig
85 val make_id : Nast.expr -> string -> string
86 val make_static_id : Nast.class_id -> string -> string
87 val get : env -> Nast.expr -> string -> int option
88 val is_invalid : env -> Nast.expr -> string -> bool
89 val get_static : env -> Nast.class_id -> string -> int option
90 val is_static_invalid : env -> Nast.class_id -> string -> bool
91 val make : Pos.t -> env -> Nast.expr -> string -> env * Local_id.t
92 val make_static : Pos.t -> env -> Nast.class_id -> string ->
93 env * Local_id.t
94 end
95 val unbind : env -> locl ty -> env * locl ty
96 val set_local : env -> Local_id.t -> locl ty -> env
97 val is_using_var : env -> Local_id.t -> bool
98 val set_using_var : env -> Local_id.t -> env
99 val unset_local : env -> Local_id.t -> env
100 val get_local : env -> Local_id.t -> locl ty
101 val set_local_expr_id : env -> Local_id.t -> expression_id -> env
102 val get_local_expr_id : env -> Local_id.t -> expression_id option
103 val get_lower_bounds : env -> string -> tparam_bounds
104 val get_upper_bounds : env -> string -> tparam_bounds
105 val add_upper_bound : env -> string -> locl ty -> env
106 val add_lower_bound : env -> string -> locl ty -> env
107 val get_equal_bounds : env -> string -> tparam_bounds
108 val union_global_tpenv : tpenv -> tpenv -> tpenv
109 val add_upper_bound_global : env -> string -> locl ty -> env
110 val add_lower_bound_global : env -> string -> locl ty -> env
111 val env_with_tpenv : env -> tpenv -> env
112 val env_with_global_tpenv : env -> tpenv -> env
113 val add_generic_parameters : env -> Nast.tparam list -> env
114 val is_generic_parameter : env -> string -> bool
115 val get_generic_parameters : env -> string list
116 val add_fresh_generic_parameter : env -> string -> env * string
117 val get_tpenv_size : env -> int
118 val set_env_reactive : env -> bool -> env
119 val env_reactive : env -> bool
120 val freeze_local_env : env -> env
121 val env_with_locals :
122 env -> local_types -> local_history Local_id.Map.t -> env
123 val anon : local_env -> env -> (env -> env * Tast.expr * locl ty) -> env * Tast.expr * locl ty
124 val in_loop : env -> (env -> env * 'a) -> env * 'a
125 val merge_locals_and_history : local_env -> old_local Local_id.Map.t
126 val separate_locals_and_history :
127 old_local Local_id.Map.t ->
128 (local_types * local_history Local_id.Map.t)