Reset local typing environment for ExprTrees
commit1a01ec7a5ec8bc1df781bd5b13b4cabbb55eb109
authorThomas Jiang <thomasjiang@fb.com>
Fri, 2 Oct 2020 21:48:33 +0000 (2 14:48 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 2 Oct 2020 21:50:42 +0000 (2 14:50 -0700)
treeb9f11fd3d3eeceb28632ec38c8185aab8069c190
parent529470414f5a5479a3c4ccf0c76200633b9efbf5
Reset local typing environment for ExprTrees

Summary:
Expression trees should not inherit the local typing environment. So the following should throw an error:

```
function test(): void {
  $x = 1;

  Code`$x + 1`;
}
```

As the expression tree should not inherit the local type for `$x`. This diff resets the locals in the typing environment for expression trees.

This diff does not account for splicing yet.

Reviewed By: Wilfred

Differential Revision: D23718691

fbshipit-source-id: 7589ea088278cabd56ea634520c39aa205f3469d
hphp/hack/src/typing/typing.ml
hphp/hack/test/typecheck/expression_trees/bound_variable_lambda.php [new file with mode: 0644]
hphp/hack/test/typecheck/expression_trees/bound_variable_lambda.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/expression_trees/mismatched_types.php [new file with mode: 0644]
hphp/hack/test/typecheck/expression_trees/mismatched_types.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/expression_trees/unbound_variables.php [new file with mode: 0644]
hphp/hack/test/typecheck/expression_trees/unbound_variables.php.exp [new file with mode: 0644]