Consume decls from Tast and decl_provider for functions
commitf77d189ec27e06842d3e1ec2f1da969af8cd1b4c
authorJames Wu <jjwu@fb.com>
Fri, 30 Oct 2020 22:43:11 +0000 (30 15:43 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 30 Oct 2020 22:45:36 +0000 (30 15:45 -0700)
tree78432196f0e3d40cf9f2eae5e71f987ba69d90d8
parent1c4d40edaf79a23b469ebd8117af1d77b186d480
Consume decls from Tast and decl_provider for functions

Summary:
This diff makes IFC consume the declarations directly from the decl heap and TAST instead of our special declaration step. In the diff, I change the IFC special declaration step to use the decl heap anyway, in order to make sure the new declaration test I added passes. I will then delete de_fun from the decl_env in the diff above it.

This also allows IFC to find the policies for methods and functions not directly declared in the file. See exceptions.php for an example of this with New.

We use the TAST for the policy information as much as possible to save decl heap accesses; `new` expressions don't have the function type of the constructor saved on the TAST, so those require a declaration heap access.

Reviewed By: zilberstein

Differential Revision: D24400904

fbshipit-source-id: f0e4ef6624f3d81db0286484ea33b8cdeb710799
13 files changed:
hphp/hack/src/ifc/dune
hphp/hack/src/ifc/ifc.ml
hphp/hack/src/ifc/ifc_decl.ml
hphp/hack/src/ifc/ifc_env.ml
hphp/hack/src/ifc/ifc_env.mli
hphp/hack/src/ifc/ifc_pretty.ml
hphp/hack/src/ifc/ifc_types.ml
hphp/hack/test/ifc/check/exceptions.php
hphp/hack/test/ifc/check/higher_order_functions.php.exp
hphp/hack/test/ifc/check/pass_external.php.exp
hphp/hack/test/ifc/check/shape_basic.php.exp
hphp/hack/test/ifc/decl/calls_basics.php [new file with mode: 0644]
hphp/hack/test/ifc/decl/calls_basics.php.exp [new file with mode: 0644]