Deduplicate some errors related to `inout` params
commit833d60fddf188fe79d7092969201d6f107037929
authorHunter Goldstein <hgoldstein@fb.com>
Mon, 18 Apr 2022 21:53:30 +0000 (18 14:53 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 18 Apr 2022 21:53:30 +0000 (18 14:53 -0700)
tree531ac81306190172a53e2c0e5aa16de3e6d0afe0
parent0bbbe72df833a079a386dd9f0366d4f00ac95f02
Deduplicate some errors related to `inout` params

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

`inout` parameter checks are done ... in a few places:
* Some are done at parse time (multiple passes: one while checking `DecoratedExpression`, one while checking all function calls)
* Some are done at naming (local typechecker check) time

These are all static, and can be done at parse time. To that end I'm folding in inout checks such that we avoid duplicating them across different parts of our error checks.

They're almost all being moved into `check_lvalue`, where we have some extra checks of the form "if the root lval is `inout`, raise an unconditional parsing error."

Reviewed By: Wilfred

Differential Revision: D35532787

fbshipit-source-id: 70a4898466d5058897e4c148dde037e5d9ca1c6d
45 files changed:
hphp/hack/src/errors/error_codes.ml
hphp/hack/src/errors/nast_check_error.ml
hphp/hack/src/errors/nast_check_error.mli
hphp/hack/src/oxidized/gen/error_codes.rs
hphp/hack/src/parser/rust_parser_errors.rs
hphp/hack/src/parser/syntax_error.rs
hphp/hack/src/typing/nast_check/inout_check.ml
hphp/hack/test/full_fidelity/cases/superglobal-reference.php.errors.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg1.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg11.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg2.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg3.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg4.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg5.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg6.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg7.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg8.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_arg9.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_byref.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue1.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue10.php [new file with mode: 0644]
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue10.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue2.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue3.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue4.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue5.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue6.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue7.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue8.php.exp
hphp/hack/test/typecheck/inout/bad_inout_use_lvalue9.php.exp
hphp/hack/test/typecheck/inout/inout_pipe_expression.php [new file with mode: 0644]
hphp/hack/test/typecheck/inout/inout_pipe_expression.php.exp [new file with mode: 0644]
hphp/test/slow/hhbbc/nullsafe_nullbase.php.expectf
hphp/test/slow/inout/bad-arg-pipe.php.expectf
hphp/test/slow/inout/bad-arg-this.php.expectf
hphp/test/slow/inout/bad-call-1.php.expectf
hphp/test/slow/inout/bad-call-11.php.expectf
hphp/test/slow/inout/bad-call-13.php.expectf
hphp/test/slow/inout/bad-call-16.php [new file with mode: 0644]
hphp/test/slow/inout/bad-call-16.php.expectf [copied from hphp/test/slow/inout/bad-call-4.php.expectf with 60% similarity]
hphp/test/slow/inout/bad-call-17.php [new file with mode: 0644]
hphp/test/slow/inout/bad-call-17.php.expectf [copied from hphp/test/slow/inout/bad-call-4.php.expectf with 60% similarity]
hphp/test/slow/inout/bad-call-2.php.expectf
hphp/test/slow/inout/bad-call-4.php.expectf
hphp/test/slow/nullsafe/nullsafe-prop-13.php.expectf