add function types to analysis machinery
commitee3443c5a8561c44513a21eedffb5f30314a04a2
authorNoam Zilberstein <noamz@fb.com>
Wed, 5 Aug 2020 17:08:32 +0000 (5 10:08 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 5 Aug 2020 17:10:27 +0000 (5 10:10 -0700)
treee5904de4389463aeb610498fe22333898a960880
parent3c896905137ce24f07d397dace6a86af6a87733b
add function types to analysis machinery

Summary:
In this diff I am adding function types as a first class concept in the IFC machinery. This means pulling typing information out of the function prototypes and into a separate record type. The subtyping function now recognizes function types and computes subtype constraints where the arguments and pc are contravariant and the exceptions and return type are covariant. As a nice side benefit, this diff greatly simplifies the logic in `Ifc_solver` as we can just call the subtyping function instead of adding all the subtype constraints in an adhoc way.

I intentionally did not implement `add_dependencies` because it's a bit complicated and we don't need it yet. I will add this soon.

Reviewed By: madgen

Differential Revision: D22867222

fbshipit-source-id: a515a3b8042bc51052494a8c0e5d795228dfb7fe
hphp/hack/src/ifc/ifc.ml
hphp/hack/src/ifc/ifc_mapper.ml
hphp/hack/src/ifc/ifc_pretty.ml
hphp/hack/src/ifc/ifc_solver.ml
hphp/hack/src/ifc/ifc_types.ml