fix yield/generator type holes
[hiphop-php.git] / hphp / hack / src / typing / typing_return.mli
blob6dc00391302a72a5bb9a1d33a23d84e25fbb6b1a
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_env_types
12 (** Typing code concerned with return types. *)
14 (** Returns the possibly enforced return type along with some other information.
15 The position parameter is used for error generation. *)
16 val make_info :
17 Pos.t ->
18 Ast_defs.fun_kind ->
19 Nast.user_attribute list ->
20 env ->
21 is_explicit:bool ->
22 Typing_defs.locl_ty ->
23 Typing_defs.decl_ty option ->
24 Typing_env_return_info.t
26 val implicit_return :
27 env ->
28 Ast_defs.pos ->
29 expected:Typing_defs.locl_ty ->
30 actual:Typing_defs.locl_ty ->
31 env
33 val make_return_type :
34 (env -> Typing_defs.decl_ty -> env * Typing_defs.locl_ty) ->
35 env ->
36 Typing_defs.decl_ty ->
37 env * Typing_defs.locl_ty
39 (** For async functions, strip Awaitable<_> from the return type *)
40 val strip_awaitable :
41 Ast_defs.fun_kind ->
42 env ->
43 Typing_defs.locl_possibly_enforced_ty ->
44 Typing_defs.locl_possibly_enforced_ty
46 val make_fresh_return_type : env -> Ast_defs.pos -> env * Typing_defs.locl_ty
48 (** Force the return type of a function to adhere to the fun_kind specified in
49 the env *)
50 val force_return_kind :
51 ?is_toplevel:bool ->
52 env ->
53 Ast_defs.pos ->
54 Typing_defs.locl_ty ->
55 env * Typing_defs.locl_ty
57 (** If there is no return type annotation on method, assume `void` for the
58 special functions `__construct`, otherwise we can assume type Tany *)
59 val make_default_return :
60 is_method:bool -> env -> Ast_defs.pos * string -> Typing_defs.locl_ty