allow to infer partially annotated classes
commitd97eb44e4805e9f3c88566a91ff1a25c914bf596
authorCatherine Gasnier <catg@fb.com>
Wed, 26 Feb 2020 19:16:04 +0000 (26 11:16 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 26 Feb 2020 19:37:03 +0000 (26 11:37 -0800)
tree98d4c098af3c109bca7104c1bcfb4909729012cd
parentbeb7b2d478c5153f484fcc797015bb454cfe41dc
allow to infer partially annotated classes

Summary:
We can't easily create type vars for partially annotated types in the decl phase, because this would require fetching the decl for the class to check its type parameters.
Instead, we create the global type variables in Typing, with its ID being a hash of the position of the partial annotation.
We also fix the setting of the variances.

Differential Revision: D20036858

fbshipit-source-id: b49bdfb427e91b9df2ab3c29f6cbf7b2d0896aa2
16 files changed:
hphp/hack/src/heap/ident.ml
hphp/hack/src/heap/ident.mli
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_phase.ml
hphp/hack/test/tast/global_inference/map.php [new file with mode: 0644]
hphp/hack/test/tast/global_inference/map.php.exp [new file with mode: 0644]
hphp/hack/test/tast/global_inference/mymap.php [new file with mode: 0644]
hphp/hack/test/tast/global_inference/mymap.php.exp [new file with mode: 0644]
hphp/hack/test/tast/global_inference/partial_annot.php [new file with mode: 0644]
hphp/hack/test/tast/global_inference/partial_annot.php.exp [new file with mode: 0644]
hphp/hack/test/tast/global_inference/partial_annot_where.php [new file with mode: 0644]
hphp/hack/test/tast/global_inference/partial_annot_where.php.exp [new file with mode: 0644]
hphp/hack/test/tast/global_inference/typeparams/type_hint_typeparameter_variance.php.exp
hphp/hack/test/unit/server_tests.ml