reorganize simplify_subtype to make certain cases work with constraint types
commitc0abed8402b88d8e7d2fe759436dc77000c1cf75
authorCatherine Gasnier <catg@fb.com>
Fri, 11 Oct 2019 14:03:17 +0000 (11 07:03 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 11 Oct 2019 14:07:18 +0000 (11 07:07 -0700)
tree37106082420c4c7e9d54e6b2e3a6a3af84b6c5b3
parentc1343fe430c4efc9e85da9dfc3136318f74c59d7
reorganize simplify_subtype to make certain cases work with constraint types

Summary:
This is in preparation to using constraint type Thas_member to typecheck property accesses (read only - currently implemented in `obj_get`.).
We want to be able to use the behavior of `simplify_subtype` to perform property accesses on things like unions and intersections. Therefore, all the cases dealing with unions, intersections, options, any, err and so on must come before the case for `LoclType ty, ConstraintType Thas_member _`. To do so, we move those cases and make them come first in `simplify_subtype`, while making sure the same inputs would match the same cases as before (which implies e.g. moving a lot of cases with Toption as well, to preserve the matching order).

Reviewed By: andrewjkennedy

Differential Revision: D17710671

fbshipit-source-id: 89f85ce9e9af8e814242f8726b5db02faea47eb9
hphp/hack/src/typing/typing_env.mli
hphp/hack/src/typing/typing_subtype.ml