add constraint on args when calling with any as function type
commit9bd019b70d48bd3b07b8800802ff519b3b618e06
authorCatherine Gasnier <catg@fb.com>
Thu, 22 Aug 2019 16:40:43 +0000 (22 09:40 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 22 Aug 2019 16:42:36 +0000 (22 09:42 -0700)
tree3582550c24bcd3f24eddfdfb3b0d78f1f1958568
parente96dd48746806476ee4d8df63e3df348d0a15dcd
add constraint on args when calling with any as function type

Summary:
When typechecking a call, if the function type is unknown (any or dynamic and the like), then its arguments should coerce to the corresponding type.
This has impact:
- in global inference:
```
class A {
  public $foo;
  public function f($x): void {
    $this->foo->bar($x);
  }
}
```
In the above, $x would have type #1, and we want to record that `#1 <: Tany` to avoid infering mixed
- But also in the general case: see the added test and the inline comments

For now, this is gated by the infer_missing flag. The question is: should it be?

Reviewed By: manzyuk

Differential Revision: D16892210

fbshipit-source-id: 83e93f1a691dbe3338cdd1bfb2c7714228f4f2da
hphp/hack/src/typing/typing.ml
hphp/hack/test/typecheck/call_fty_any.php [new file with mode: 0644]
hphp/hack/test/typecheck/call_fty_any.php.exp [new file with mode: 0644]