Make Hack type checker produce error when async method is not awaitable (rd. 2)
commit6dcb2bfd98f91e6df9f484510aa63d37d9ddbd34
authorMatt Lim <mlim@fb.com>
Fri, 6 Oct 2017 05:26:28 +0000 (5 22:26 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 6 Oct 2017 05:45:44 +0000 (5 22:45 -0700)
treed542e3e346c24fbcc95755a2af8112a69a46ca1f
parent12c8dfa351b6419c611a7fe5b8b10e551c769073
Make Hack type checker produce error when async method is not awaitable (rd. 2)

Summary:
If async functions and methods have a return type hint, it must be Awaitable. Previously, the type checker was not enforcing it. Now it is.

(also fixed a faulty test)

Reviewed By: andrewjkennedy

Differential Revision: D5946619

fbshipit-source-id: 0615379764dc0a9e033a7bed3cc724dd38e3d226
20 files changed:
hphp/hack/src/typing/typing.ml
hphp/hack/src/utils/errors/errors.ml
hphp/hack/src/utils/errors/errors_sig.ml
hphp/hack/test/typecheck/async_hint1.php [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint1.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint2.php [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint2.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint3.php [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint3.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint4.php [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint4.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint5.php [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint5.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint6.php [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint6.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint7.php [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint7.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint8.php [new file with mode: 0644]
hphp/hack/test/typecheck/async_hint8.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/tconst/tconst_this_ty_generics.php