don't recreate global type var if it already exists
commit5c9580bd26d8dd690aceb5b0980dcbb436e636e5
authorCatherine Gasnier <catg@fb.com>
Fri, 24 Jan 2020 18:43:39 +0000 (24 10:43 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 24 Jan 2020 18:55:35 +0000 (24 10:55 -0800)
tree7c22b027d30fbbb5b89331e664fbd05c41acc0cf
parentdcb2537429f46cf91585f4a9bec069c879ced466
don't recreate global type var if it already exists

Summary:
When localizing a global type variable, the type variable might have already been localized and therefore be already in the environment, for example when typechecking a method: we localize once while checking that the class does extend its parent, and once again while typechecking the body of the method.
Therefore, we should make sure we do not erase and recreate a type variable that already exists.

Differential Revision: D19539000

fbshipit-source-id: c0c58f60506866fd00b7263e72893a5a57bd78b3
hphp/hack/src/hh_single_type_check.ml
hphp/hack/src/typing/typing.ml
hphp/hack/src/typing/typing_env.ml
hphp/hack/src/typing/typing_env.mli
hphp/hack/src/typing/typing_extends.ml
hphp/hack/src/typing/typing_inference_env.ml
hphp/hack/src/typing/typing_inference_env.mli
hphp/hack/src/typing/typing_phase.ml
hphp/hack/src/typing/typing_subtype.ml