Extend infer-missing option with a new possible value
[hiphop-php.git] / hphp / hack / src / typing / typing_env_types_sig.mli
blob51269b6851cf4383a69e97840739c56350c3ea9f
1 (*
2 * Copyright (c) 2015, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 open Typing_defs
11 module TySet = Typing_set
12 module type S = sig
14 (* Local environment includes types of locals and bounds on type parameters. *)
15 type local_env = {
16 per_cont_env : Typing_per_cont_env.t;
17 local_mutability : Typing_mutability_env.mutability_env;
18 local_reactive : reactivity;
19 (* Local variables that were assigned in a `using` clause *)
20 local_using_vars : Local_id.Set.t;
23 type tyvar_info = {
24 tyvar_pos: Pos.t;
25 eager_solve_fail: bool;
26 appears_covariantly: bool;
27 appears_contravariantly: bool;
28 lower_bounds : TySet.t;
29 upper_bounds : TySet.t;
30 type_constants : (Aast.sid * locl ty) SMap.t;
32 type tvenv = tyvar_info IMap.t
34 type env = {
35 (* position of the function/method being checked *)
36 function_pos: Pos.t ;
37 tenv : locl ty IMap.t ;
38 subst : int IMap.t ;
39 fresh_typarams : SSet.t;
40 lenv : local_env ;
41 genv : genv ;
42 decl_env: Decl_env.env;
43 in_loop : bool ;
44 in_try : bool ;
45 in_case : bool ;
46 inside_constructor: bool;
47 inside_ppl_class: bool;
48 (* A set of constraints that are global to a given method *)
49 global_tpenv : Type_parameter_env.t;
50 subtype_prop : Typing_logic.subtype_prop;
51 log_levels : int SMap.t;
52 tvenv : tvenv;
53 tyvars_stack : (Pos.t * Ident.t list) list;
54 allow_wildcards : bool;
55 big_envs : (Pos.t * env) list ref ;
56 pessimize : bool;
58 and genv = {
59 tcopt : TypecheckerOptions.t;
60 return : Typing_env_return_info.t;
61 (* For each function parameter, its type and calling convention. *)
62 params : (locl ty * param_mode) Local_id.Map.t;
63 (* condition types associated with parameters.
64 For every mayberx parameter that has condition type we create
65 fresh type parameter (see: make_local_param_ty) and store mapping
66 fresh type name -> condition type in env so it can be retrieved later *)
67 condition_types: decl ty SMap.t;
68 parent_id : string;
69 parent : decl ty;
70 (* Identifier of the enclosing class *)
71 self_id : string;
72 (* Type of the enclosing class, instantiated at its generic parameters *)
73 self : locl ty;
74 static : bool;
75 fun_kind : Ast_defs.fun_kind;
76 val_kind : Typing_defs.val_kind;
77 fun_mutable : param_mutability option;
78 anons : anon IMap.t;
79 file : Relative_path.t;
82 (* A type-checker for an anonymous function
83 * Parameters are
84 * - the environment
85 * - types of the parameters under which the body should be checked
86 * - the arity of the function
87 * - the expected return type of the body (optional)
89 and anon_log = locl ty list * locl ty list
90 and anon = {
91 rx : reactivity;
92 is_coroutine : Aast.is_coroutine;
93 counter : anon_log ref;
94 pos : Pos.t;
95 typecheck :
96 ?el:Nast.expr list ->
97 ?ret_ty: locl ty ->
98 env ->
99 locl fun_params ->
100 locl fun_arity ->
101 env * Tast.expr * locl ty;