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.
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. *)
19 Nast.user_attribute list
->
22 Typing_defs.locl_ty
->
23 Typing_defs.decl_ty
option ->
24 Typing_env_return_info.t
29 expected
:Typing_defs.locl_ty
->
30 actual
:Typing_defs.locl_ty
->
33 val make_return_type
:
34 (env
-> Typing_defs.decl_ty
-> env
* Typing_defs.locl_ty
) ->
36 Typing_defs.decl_ty
->
37 env
* Typing_defs.locl_ty
39 (** For async functions, strip Awaitable<_> from the return type *)
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
50 val force_return_kind
:
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