First stage of constraints refactoring: bounds environment
[hiphop-php.git] / hphp / hack / src / typing / typing_instantiate.mli
blobb0fc024205a695009e4e2dbd51d2e11ad6b9aae3
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 *)
11 open Typing_defs
13 (*****************************************************************************)
14 (* Types *)
15 (*****************************************************************************)
17 type subst
19 (*****************************************************************************)
20 (* Builds a substitution out of a list of type parameters and a list of types.
22 * Typical use-case:
23 * class Y<T> { ... }
24 * class X extends Y<int>
26 * To build the type of X, we to replace all the occurrences of T in Y by int.
27 * The function make_subst, builds the substition (the map associating types
28 * to a type parameter name), in this case, it would build the map(T => int).
30 (*****************************************************************************)
32 val make_subst: decl tparam list -> decl ty list -> subst
34 (*****************************************************************************)
35 (* Primitive instantiating a type.
36 * TODO: explain what instantiation is about.
38 (*****************************************************************************)
40 val instantiate : subst -> decl ty -> decl ty
41 val instantiate_ce : subst -> class_elt -> class_elt
42 val instantiate_typeconst :
43 subst -> typeconst_type -> typeconst_type