2 * Copyright (c) 2015, Facebook, Inc.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
10 module Env
= Typing_env
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
:
29 description_of_expected
:string ->
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
:
49 ?allow_nothing
:bool ->
51 description_of_expected
:string ->
52 (env
-> locl_ty
-> (env
* Typing_error.t
option) * locl_ty
option) ->
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