Improve error message on misplaced async modifiers
commit29c4124eed7438376a624bd9d2656f12a3362a89
authorWilfred Hughes <wilfred@fb.com>
Mon, 24 Jun 2019 18:19:17 +0000 (24 11:19 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Mon, 24 Jun 2019 18:23:06 +0000 (24 11:23 -0700)
treec283fc0eadfb11f6ed79685e0a8c8df866624372
parentfccfa46075f20696db7fc52320620abc7ef5a2a5
Improve error message on misplaced async modifiers

Summary:
For syntax errors due to a misplaced `async` modifier, inform the user what they should do.

Also improve the error message so it's specific to the current code (interface methods versus abstract methods).

Remove the corresponding NastCheck for async modifiers, as it was dead code (we stop at the syntax error).

Differential Revision: D15920020

fbshipit-source-id: 3aa80a68ade2dafafae3d65f22403c73f372698b
14 files changed:
hphp/hack/src/errors/error_codes.ml
hphp/hack/src/errors/errors.ml
hphp/hack/src/errors/errors.mli
hphp/hack/src/parser/full_fidelity_parser_errors.ml
hphp/hack/src/parser/full_fidelity_syntax_error.ml
hphp/hack/src/parser/full_fidelity_syntax_error.mli
hphp/hack/src/parser/syntax_error.rs
hphp/hack/src/typing/nast_check/interface_check.ml
hphp/hack/test/errors/error_map.ml
hphp/hack/test/full_fidelity/cases/test_async_errors.php.errors.exp
hphp/hack/test/typecheck/interface_async_method.php.exp
hphp/test/slow/parser/async_bad_class.php.expectf
hphp/test/slow/parser/async_bad_if.php.expectf
hphp/test/slow/parser/async_bad_tr.php.expectf