Move to use libcurl-minimal
[hiphop-php.git] / hphp / hack / src / typing / typing_solver.mli
blob4ea6ad63ca941b03185dfc9587332dc67452752d
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 module Env = Typing_env
11 open Typing_defs
12 open Typing_env_types
14 (* Non-side-effecting test for subtypes.
15 result = true implies ty1 <: ty2
16 result = false implies NOT ty1 <: ty2 OR we don't know
18 val is_sub_type : env -> locl_ty -> locl_ty -> bool * Typing_error.t option
20 val non_null : env -> Pos_or_decl.t -> locl_ty -> env * locl_ty
22 (* Force solve all remaining unsolved type variables *)
23 val solve_all_unsolved_tyvars : env -> env * Typing_error.t option
25 val expand_type_and_solve :
26 env ->
27 ?default:locl_ty ->
28 ?freshen:bool ->
29 description_of_expected:string ->
30 Pos.t ->
31 locl_ty ->
32 (env * Typing_error.t option) * locl_ty
34 val expand_type_and_solve_eq :
35 env -> locl_ty -> (env * Typing_error.t option) * locl_ty
37 (** Expand an already-solved type variable to its solution.
38 If the type variable is not yet solved, but one of its lower bounds is dynamic,
39 i.e. dynamic, t1, ..., tn <: #0 <: u1, ..., um,
40 then solve the type variable to #0 := ~#1 for fresh type variable #1, where
41 t1, ..., tn <: #1 <: u1, ..., um.
42 This is used in the strip_dynamic functions in Typing_dynamic_utils before matching the type on ~t
44 val expand_type_for_strip_dynamic : env -> locl_ty -> env * locl_ty
46 val expand_type_and_narrow :
47 env ->
48 ?default:locl_ty ->
49 ?allow_nothing:bool ->
50 ?force_solve:bool ->
51 description_of_expected:string ->
52 (env -> locl_ty -> (env * Typing_error.t option) * locl_ty option) ->
53 Pos.t ->
54 locl_ty ->
55 (env * Typing_error.t option) * locl_ty
57 val solve_to_equal_bound_or_wrt_variance :
58 env -> Reason.t -> Tvid.t -> env * Typing_error.t option
60 val close_tyvars_and_solve : env -> env * Typing_error.t option
62 val bind : env -> Tvid.t -> locl_ty -> env * Typing_error.t option
64 val try_bind_to_equal_bound : env -> Tvid.t -> env * Typing_error.t option