Make Typing_instantiate only work on decl ty
[hiphop-php.git] / hphp / hack / src / typing / typing_env.mli
blob723ed8c3b467c03d1f04ea4bc79d2f86c84a377b
1 (**
2 * Copyright (c) 2014, 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 *)
11 open Utils
12 open Typing_defs
14 module Funs : module type of Typing_heap.Funs
15 module Classes : module type of Typing_heap.Classes
16 module Typedefs : module type of Typing_heap.Typedefs
17 module GConsts : module type of Typing_heap.GConsts
19 type fake_members = {
20 last_call : Pos.t option;
21 invalid : SSet.t;
22 valid : SSet.t;
24 type local = locl ty list * locl ty
25 type local_env = fake_members * local IMap.t
26 type env = {
27 pos : Pos.t;
28 tenv : locl ty IMap.t;
29 subst : int IMap.t;
30 lenv : local_env;
31 genv : genv;
32 todo : tfun list;
33 in_loop : bool;
34 grow_super : bool;
36 and genv
37 and anon = env -> locl fun_params -> env * locl ty
38 and tfun = env -> env
39 val fresh : unit -> int
40 val fresh_type : unit -> locl ty
41 val add_subst : env -> int -> int -> env
42 val get_var : env -> int -> env * int
43 val rename : env -> int -> int -> env
44 val add : env -> int -> locl ty -> env
45 val get_type : env -> int -> env * locl ty
46 val get_type_unsafe : env -> int -> env * locl ty
47 val expand_type : env -> locl ty -> env * locl ty
48 val expand_type_recorded : env -> ISet.t -> locl ty -> env * ISet.t * locl ty
49 val make_ft : Pos.t -> decl fun_params -> decl ty -> decl fun_type
50 val get_shape_field_name : Nast.shape_field_name -> string
51 val debugl : ISet.t -> env -> locl ty list -> unit
52 val debug : env -> locl ty -> unit
53 val empty_fake_members : fake_members
54 val empty_local : local_env
55 val empty : TypecheckerOptions.t -> Relative_path.t -> env
56 val add_class : Classes.key -> Classes.t -> unit
57 val add_typedef : Typedefs.key -> Typing_heap.Typedef.tdef -> unit
58 val is_typedef : Typedefs.key -> bool
59 val get_enum : Classes.key -> Classes.t option
60 val is_enum : Classes.key -> bool
61 val get_enum_constraint : Classes.key -> decl ty option
62 val add_typedef_error : Typedefs.key -> unit
63 val add_fun : Funs.key -> Funs.t -> unit
64 val add_wclass : env -> string -> unit
65 val fresh_tenv : env -> (env -> unit) -> unit
66 val get_class : env -> Classes.key -> Classes.t option
67 val get_typedef : env -> Typedefs.key -> Typedefs.t option
68 val add_extends_dependency : env -> string -> unit
69 val get_class_dep : env -> Classes.key -> Classes.t option
70 val get_const : env -> class_type -> string -> class_elt option
71 val get_gconst : env -> GConsts.key -> GConsts.t option
72 val get_static_member : bool -> env -> class_type -> string -> class_elt option
73 val suggest_static_member :
74 bool -> class_type -> string -> (Pos.t * string) option
75 val get_member : bool -> env -> class_type -> string -> class_elt option
76 val suggest_member : bool -> class_type -> string -> (Pos.t * string) option
77 val get_construct : env -> class_type -> class_elt option * bool
78 val get_todo : env -> tfun list
79 val get_return : env -> locl ty
80 val set_return : env -> locl ty -> env
81 val with_return : env -> (env -> env) -> env
82 val is_static : env -> bool
83 val grow_super : env -> bool
84 val invert_grow_super : env -> (env -> env) -> env
85 val get_self : env -> locl ty
86 val get_self_id : env -> string
87 val get_parent : env -> decl ty
88 val get_fn_kind : env -> Ast.fun_kind
89 val get_file : env -> Relative_path.t
90 val get_fun : env -> Funs.key -> Funs.t option
91 val set_fn_kind : env -> Ast.fun_kind -> env
92 val add_todo : env -> tfun -> env
93 val add_anonymous : env -> anon -> env * int
94 val set_anonymous : env -> int -> anon -> env
95 val get_anonymous : env -> int -> anon option
96 val set_self_id : env -> string -> env
97 val set_self : env -> locl ty -> env
98 val set_parent : env -> decl ty -> env
99 val set_static : env -> env
100 val set_mode : env -> FileInfo.mode -> env
101 val set_root : env -> Typing_deps.Dep.variant -> env
102 val set_is_constructor : env -> env
103 val is_constructor : env -> bool
104 val get_mode : env -> FileInfo.mode
105 val is_strict : env -> bool
106 val is_decl : env -> bool
107 val get_options: env -> TypecheckerOptions.t
108 val get_last_call : env -> Pos.t
109 val lost_info : string -> ISet.t -> env -> locl ty -> env * locl ty
110 val forget_members : env -> Pos.t -> env
111 module FakeMembers :
113 val make_id : Nast.expr -> string -> string
114 val make_static_id : Nast.class_id -> string -> string
115 val get : env -> Nast.expr -> string -> int option
116 val is_invalid : env -> Nast.expr -> string -> bool
117 val get_static : env -> Nast.class_id -> string -> int option
118 val is_static_invalid : env -> Nast.class_id -> string -> bool
119 val make : Pos.t -> env -> Nast.expr -> string -> env * int
120 val make_static : Pos.t -> env -> Nast.class_id -> string -> env * int
122 val unbind : env -> locl ty -> env * locl ty
123 val set_local : env -> Ident.t -> locl ty -> env
124 val get_local : env -> Ident.t -> env * locl ty
125 val freeze_local_env : env -> env
126 val anon : local_env -> env -> (env -> env * locl ty) -> env * locl ty
127 val in_loop : env -> (env -> env) -> env