Do not infer the any type when lambda has no return type annotation
commitd1f2cbcb1c342a7d45375f253789e3099b6fb0c0
authorAndrew Kennedy <akenn@fb.com>
Wed, 16 Jan 2019 17:28:06 +0000 (16 09:28 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 16 Jan 2019 17:31:43 +0000 (16 09:31 -0800)
tree78df5a6dc7b350cc320a93a2af236c5ec5290424
parent796aad97181a37638a3eb26355a2f74118962226
Do not infer the any type when lambda has no return type annotation

Summary:
In some circumstances the type displayed by `hh_show` for a lambda involved the "any" type, displayed as `_`.
This is an unsoundness in the checking of lambdas (see tests).

Fix is simply to pass `None` for the expected type in bidirectional type checking, when there is no explicit return hint.

Reviewed By: arun11111

Differential Revision: D13692386

fbshipit-source-id: df34a257d256e2329637247a6a111af493bcd2d0
hphp/hack/src/typing/typing.ml
hphp/hack/src/typing/typing_log.ml
hphp/hack/test/infer_return_types/array.php.exp
hphp/hack/test/typecheck/lambda/lambda_any_bad.php [new file with mode: 0644]
hphp/hack/test/typecheck/lambda/lambda_any_bad.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/lambda/lambda_any_return_bug.php [new file with mode: 0644]
hphp/hack/test/typecheck/lambda/lambda_any_return_bug.php.exp [new file with mode: 0644]