Error when reified method + __DynamicallyCallable attribute
commit31bf97562c8c5fa70db758bf47bf36810ef41f98
authorThomas Jiang <thomasjiang@fb.com>
Tue, 6 Oct 2020 04:50:17 +0000 (5 21:50 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 6 Oct 2020 04:54:35 +0000 (5 21:54 -0700)
treece645ca6e31cbbf1308e49f8d8d5956c2c7669ed
parent965aa5750d7a6b14060590cb3afe435e60ba61bc
Error when reified method + __DynamicallyCallable attribute

Summary:
You are unable to call a reified function or method via `dynamic_fun`, `dynamic_class_meth`, `dynamic_fun_force` and `dynamic_class_meth_force`. You get an error when you attempt to do so. However, since this error is a runtime error, users may still want to annotate reified functions and methods with `__DynamicallyCallable`.

Just throw a Hack error if they attempt to mark a reified function or method with that attribute.

Reviewed By: Wilfred

Differential Revision: D24065373

fbshipit-source-id: 8cc0a56cd0f27b2ba540c3a26c229b9d85a2a7c5
13 files changed:
hphp/hack/src/errors/error_codes.ml
hphp/hack/src/errors/errors.ml
hphp/hack/src/errors/errors.mli
hphp/hack/src/oxidized/gen/error_codes.rs
hphp/hack/src/typing/nast_check/dynamically_callable_attr_check.ml
hphp/hack/test/typecheck/dynamic_calls/dynamically_callable_reified.php [new file with mode: 0644]
hphp/hack/test/typecheck/dynamic_calls/dynamically_callable_reified.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/dynamic_calls/dynamically_callable_reified2.php [new file with mode: 0644]
hphp/hack/test/typecheck/dynamic_calls/dynamically_callable_reified2.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/dynamic_calls/dynamically_callable_soft_reified.php [new file with mode: 0644]
hphp/hack/test/typecheck/dynamic_calls/dynamically_callable_soft_reified.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/dynamic_calls/dynamically_callable_soft_reified2.php [new file with mode: 0644]
hphp/hack/test/typecheck/dynamic_calls/dynamically_callable_soft_reified2.php.exp [new file with mode: 0644]