Virtualize boolean `!` instead of previous desugaring
commit656767a58d338f502a6df92b5ae12030597d5f77
authorThomas Jiang <thomasjiang@fb.com>
Thu, 12 Nov 2020 05:59:05 +0000 (11 21:59 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 12 Nov 2020 06:01:46 +0000 (11 22:01 -0800)
treea69f8ddc8ab96349eea9785d820a2952f6a101f5
parent35446e24ec11f5728433f222ac4c9543fed4f2b3
Virtualize boolean `!` instead of previous desugaring

Summary:
This diff changes the previous strategy for desugaring boolean not `!`.

Previously, we were not virtualizing for typechecking. And we were previously desugaring for runtime:

```
Example`!$my_bool`;
```
to
```
(Example $v) ==> {
  return $v->exclamationMark(..., $v->localVar(..., '$my_bool');
}
```

Now, we will do the following, we will virtualize for typechecking:

```
`$my_bool->__exclamationMark()`
```

And the following for runtime:

```
(Example $v) ==> {
  return $v->methCall(
    ...
    $v->localVar(..., '$my_bool'),
    '__exclamationMark',
    vec[],
  );
}
```

Reviewed By: Wilfred

Differential Revision: D24878303

fbshipit-source-id: 406d637bc54879d7ec1097d99ead785f2416e5e9
52 files changed:
hphp/hack/src/parser/lowerer/desugar_expression_tree.rs
hphp/hack/test/typecheck/expression_trees/add.php
hphp/hack/test/typecheck/expression_trees/assign.php
hphp/hack/test/typecheck/expression_trees/boolean_and.php
hphp/hack/test/typecheck/expression_trees/boolean_check.php
hphp/hack/test/typecheck/expression_trees/boolean_operators.php
hphp/hack/test/typecheck/expression_trees/boolean_operators.php.exp
hphp/hack/test/typecheck/expression_trees/boolean_or.php
hphp/hack/test/typecheck/expression_trees/bound_variable_lambda.php
hphp/hack/test/typecheck/expression_trees/break.php
hphp/hack/test/typecheck/expression_trees/call.php
hphp/hack/test/typecheck/expression_trees/comparison_operators.php
hphp/hack/test/typecheck/expression_trees/consecutive_splicing.php
hphp/hack/test/typecheck/expression_trees/continue.php
hphp/hack/test/typecheck/expression_trees/expr_tree_defs.php
hphp/hack/test/typecheck/expression_trees/hover_type.php
hphp/hack/test/typecheck/expression_trees/if.php
hphp/hack/test/typecheck/expression_trees/infinite_loop.php
hphp/hack/test/typecheck/expression_trees/invalid_operator.php
hphp/hack/test/typecheck/expression_trees/lambda.php
hphp/hack/test/typecheck/expression_trees/loop.php
hphp/hack/test/typecheck/expression_trees/mismatched_types.php
hphp/hack/test/typecheck/expression_trees/mismatched_types.php.exp
hphp/hack/test/typecheck/expression_trees/nested_expression_trees.php
hphp/hack/test/typecheck/expression_trees/nested_splicing.php
hphp/hack/test/typecheck/expression_trees/nested_splicing2.php
hphp/hack/test/typecheck/expression_trees/not.php
hphp/hack/test/typecheck/expression_trees/null.php
hphp/hack/test/typecheck/expression_trees/parse_constants.php
hphp/hack/test/typecheck/expression_trees/parse_constants.php.exp
hphp/hack/test/typecheck/expression_trees/splice.php
hphp/hack/test/typecheck/expression_trees/splice2.php
hphp/hack/test/typecheck/expression_trees/splice_err1.php
hphp/hack/test/typecheck/expression_trees/splice_err1.php.exp
hphp/hack/test/typecheck/expression_trees/splice_err2.php
hphp/hack/test/typecheck/expression_trees/splice_err2.php.exp
hphp/hack/test/typecheck/expression_trees/splice_err3.php
hphp/hack/test/typecheck/expression_trees/splice_err3.php.exp
hphp/hack/test/typecheck/expression_trees/splice_err4.php
hphp/hack/test/typecheck/expression_trees/splice_err4.php.exp
hphp/hack/test/typecheck/expression_trees/splice_err4.php.like_types.exp
hphp/hack/test/typecheck/expression_trees/splice_infer.php
hphp/hack/test/typecheck/expression_trees/splice_state.php
hphp/hack/test/typecheck/expression_trees/splice_state2.php
hphp/hack/test/typecheck/expression_trees/splice_state3.php
hphp/hack/test/typecheck/expression_trees/splice_state4.php
hphp/hack/test/typecheck/expression_trees/splice_variable.php
hphp/hack/test/typecheck/expression_trees/splice_variable2.php
hphp/hack/test/typecheck/expression_trees/splice_variable3.php
hphp/hack/test/typecheck/expression_trees/splice_variable4.php
hphp/hack/test/typecheck/expression_trees/splice_variable_state.php
hphp/hack/test/typecheck/expression_trees/unbound_variables.php