Desugar function calls
commit9c5846d40cd26735fb90a5447ae134f680bd5c2b
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:13 +0000 (11 22:01 -0800)
treecbdb83b23e1c712bfb330a6793d824adfd2922fa
parent06573e69f594294dcf244af757c5a61a7e62f865
Desugar function calls

Summary:
We want to desugar function calls a bit specially:

```
MyVisitor`foo(...)`
```
is desugared for typechecking as
```
__splice__( MyVisitor::symbol('foo', foo<>) )( ... )
```
and then this is desugared for runtime as
```
(MyVisitor $v) ==> {
  return $v->call(
    new ExprPos(...),
    $v->splice( MyVisitor::symbol('foo', foo<>) ),
    vec[ ... ],
  );
}
```

Reviewed By: Wilfred

Differential Revision: D24686823

fbshipit-source-id: 6c5f1caf94ad351eae49697d36c73285cdb8aba7
64 files changed:
hphp/hack/src/parser/lowerer/desugar_expression_tree.rs
hphp/hack/test/nast/expression_tree_for.php.exp
hphp/hack/test/nast/expression_tree_loop.php.exp
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_check.php.exp
hphp/hack/test/typecheck/expression_trees/boolean_check.php.like_types.exp [new file with mode: 0644]
hphp/hack/test/typecheck/expression_trees/boolean_operators.php [copied from hphp/hack/test/typecheck/expression_trees/boolean_check.php with 79% similarity]
hphp/hack/test/typecheck/expression_trees/boolean_operators.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/expression_trees/boolean_operators.php.like_types.exp [new file with mode: 0644]
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/call.php.like_types.exp [copied from hphp/hack/test/typecheck/expression_trees/splice_err2.php.like_types.exp with 65% similarity]
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 [copied from hphp/hack/test/typecheck/expression_trees/call.php with 89% similarity]
hphp/hack/test/typecheck/expression_trees/infinite_loop.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/expression_trees/infinite_loop.php.like_types.exp [new file with mode: 0644]
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/loop.php.like_types.exp
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/mismatched_types.php.like_types.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_err2.php.like_types.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_err3.php.like_types.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
hphp/test/slow/expression_trees/basic.php