Move "function call in lvalue" check from `typing.ml` to TAST check
commite17cd5f50dd38159ec4e1ec2f0e1fce187ea20fa
authorHunter Goldstein <hgoldstein@fb.com>
Tue, 8 Mar 2022 23:42:24 +0000 (8 15:42 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 8 Mar 2022 23:42:24 +0000 (8 15:42 -0800)
tree6ae787c8fac73fc65bf39f413879db97e9364466
parent1ccb15e77fb52ba737513972fa61d480b5d05203
Move "function call in lvalue" check from `typing.ml` to TAST check

Summary:
**Context:** I'm trying to change Hack to treat lvals more consistently, with the ultimate goal of encoding lvals distinctly within Hack itself.

This diff moves a check that was embedded into `typing.ml` to a tast check, which gives us two benefits:
* This will allow us to expand the scope of this particular lvalue check (namely to `unset` expressions) easily
* This lets us limit the scope of this lvalue check (namely we no longer double error on function calls in `inout` expressions)

Reviewed By: Wilfred

Differential Revision: D34562423

fbshipit-source-id: 477ed8393b3110a00bd18a667cba32f7d33aaa1d
hphp/hack/src/typing/tast_check/call_in_subscript_check.ml [new file with mode: 0644]
hphp/hack/src/typing/tast_check/tast_check.ml
hphp/hack/src/typing/typing.ml
hphp/hack/test/typecheck/function_call_incr_decr.php [new file with mode: 0644]
hphp/hack/test/typecheck/function_call_incr_decr.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue6.php
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue6.php.exp