Basic handling of callable returns
commit57aac6d33f10d89ec9d9a513a063976459bb3e93
authorMistral Orhan Jean-Pierre Contrastin <mojpc2@fb.com>
Mon, 18 Jul 2022 20:01:16 +0000 (18 13:01 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 18 Jul 2022 20:01:16 +0000 (18 13:01 -0700)
treeda91baa666ac9392da109fe87670d63a2dabcf72
parent6e01286166f7eb66e10ca495bf6dbd280cda5e12
Basic handling of callable returns

Summary:
This diff adds support for
1. inferring shape types at return type hints,
2. handling returns with no expressions,
3. and emitting codemoding directives for returns.

We generate subset constraints from the return expression entities into the unique return entity stored in the environment.

The treatment is incomplete in case of multiple returns that will come in a different diff. See T125884349.

Differential Revision: D37787587

fbshipit-source-id: e90fdf784418ec6eb1a81670f506d8241a780748
18 files changed:
hphp/hack/src/shape_analysis/shape_analysis.mli
hphp/hack/src/shape_analysis/shape_analysis_codemod.ml
hphp/hack/src/shape_analysis/shape_analysis_env.ml
hphp/hack/src/shape_analysis/shape_analysis_env.mli
hphp/hack/src/shape_analysis/shape_analysis_solver.ml
hphp/hack/src/shape_analysis/shape_analysis_types.ml
hphp/hack/src/shape_analysis/shape_analysis_types.mli
hphp/hack/src/shape_analysis/shape_analysis_walker.ml
hphp/hack/src/shape_analysis/shape_analysis_walker.mli
hphp/hack/src/typing/tast_check/shape_analysis_logger.ml
hphp/hack/test/shape_analysis/codemod/return1.php [new file with mode: 0644]
hphp/hack/test/shape_analysis/codemod/return1.php.exp [new file with mode: 0644]
hphp/hack/test/shape_analysis/simplify_constraints/return1.php [new file with mode: 0644]
hphp/hack/test/shape_analysis/simplify_constraints/return1.php.exp [new file with mode: 0644]
hphp/hack/test/shape_analysis/simplify_constraints/return2.php [new file with mode: 0644]
hphp/hack/test/shape_analysis/simplify_constraints/return2.php.exp [new file with mode: 0644]
hphp/hack/test/shape_analysis/simplify_constraints/return3.php [new file with mode: 0644]
hphp/hack/test/shape_analysis/simplify_constraints/return3.php.exp [new file with mode: 0644]