Make Hack type checker produce error when async method is not awaitable
commita07b1df8f1587b957656ebf175230605a5fe0248
authorMatt Lim <mlim@fb.com>
Thu, 28 Sep 2017 17:47:07 +0000 (28 10:47 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 28 Sep 2017 18:22:46 +0000 (28 11:22 -0700)
tree61688d60165fc2daa133069078fe72666f9a4096
parentb6dc18d3efe6b9a78c4607124c23210e3fabff2a
Make Hack type checker produce error when async method is not awaitable

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: D5891973

fbshipit-source-id: b3692ce6a10157636c18a05779369d2f915ad214
18 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/tconst/tconst_this_ty_generics.php