Improve lambda parameter inference for mixed/dynamic
commitbfd338ff5eb2cba717a0275f00d37165138f309f
authorMistral Orhan Jean-Pierre Contrastin <mojpc2@fb.com>
Thu, 4 Feb 2021 16:12:07 +0000 (4 08:12 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 4 Feb 2021 16:15:50 +0000 (4 08:15 -0800)
treed38fd18c0dfad6391ef636582a4d6d452497b70d
parentefa64632631dd6beb692a03d994f8d75b5c4165d
Improve lambda parameter inference for mixed/dynamic

Summary:
Adopts the following rule when dealing with expected type of a lambda is `mixed` or `dynamic`.
```
G, x : mixed/dynamic |- e : mixed/dynamic
-----------------------------------------
     G |- (\x -> e) : mixed/dynamic
```

Reviewed By: andrewjkennedy

Differential Revision: D26200919

fbshipit-source-id: 5942210d650c4389558478c7999396d6b89c1233
12 files changed:
hphp/hack/src/typing/typing.ml
hphp/hack/test/typecheck/dynamic_lambda_ok.php [new file with mode: 0644]
hphp/hack/test/typecheck/dynamic_lambda_ok.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/lambda/untyped_lambda_strict_mode.php.exp
hphp/hack/test/typecheck/mixed_lambda_explicit_return_ko.php [new file with mode: 0644]
hphp/hack/test/typecheck/mixed_lambda_explicit_return_ko.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/mixed_lambda_ko.php [new file with mode: 0644]
hphp/hack/test/typecheck/mixed_lambda_ko.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/mixed_lambda_ok.php [new file with mode: 0644]
hphp/hack/test/typecheck/mixed_lambda_ok.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/semi_mixed_lambda_ko.php [new file with mode: 0644]
hphp/hack/test/typecheck/semi_mixed_lambda_ko.php.exp [new file with mode: 0644]