Introduce __ReturnsVoidToRx
commitd9e4630a4ddc2ed3934aa6ed0bd2839f9cf2e56f
authorVladimir Matveev <vladima@fb.com>
Sat, 19 May 2018 20:09:05 +0000 (19 13:09 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Sat, 19 May 2018 20:26:13 +0000 (19 13:26 -0700)
tree3f0f764d48512c7473d541cf54c474019647ec85
parent8fb0181a128c30f0bd3ba3d43ee290371f99179b
Introduce __ReturnsVoidToRx

Summary: This diff adds support for `__ReturnsVoidToRx` attribute which forces return type of the function to be `void` in reactive context. As a consequence methods annotated with this attribute are allowed to return mutably borrowed values (specifically `$this`) since rx caller will see return type as void and won't be able to use it.

Reviewed By: KendallHopkins

Differential Revision: D8038195

fbshipit-source-id: b1903d08c9f2d8b8e4e73239646d2e6b0851890f
35 files changed:
hphp/hack/src/decl/decl.ml
hphp/hack/src/decl/decl_hint.ml
hphp/hack/src/errors/errors.ml
hphp/hack/src/errors/errors_sig.ml
hphp/hack/src/naming/naming_special_names.ml
hphp/hack/src/typing/tast_expand.ml
hphp/hack/src/typing/typing.ml
hphp/hack/src/typing/typing_defs.ml
hphp/hack/src/typing/typing_env.ml
hphp/hack/src/typing/typing_env_return_info.ml
hphp/hack/src/typing/typing_extends.ml
hphp/hack/src/typing/typing_log.ml
hphp/hack/src/typing/typing_mutability.ml
hphp/hack/src/typing/typing_mutability.mli
hphp/hack/src/typing/typing_reactivity.ml
hphp/hack/src/typing/typing_return.ml
hphp/hack/src/typing/typing_subtype.ml
hphp/hack/src/typing/typing_unify.ml
hphp/hack/test/errors/error_map.ml
hphp/hack/test/typecheck/reactive/returns_void_to_rx1.php [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx1.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx2.php [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx2.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx3.php [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx3.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx4.php [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx4.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx5.php [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx5.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx6.php [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx6.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx7.php [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx7.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx8.php [new file with mode: 0644]
hphp/hack/test/typecheck/reactive/returns_void_to_rx8.php.exp [new file with mode: 0644]