Emit error when type param declaration shadows global type name
commit5711d5d07980d63898e76e691fc48e27383c4dc5
authorVassil Mladenov <vmladenov@fb.com>
Sat, 2 Feb 2019 00:28:43 +0000 (1 16:28 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Sat, 2 Feb 2019 00:40:16 +0000 (1 16:40 -0800)
tree43e19f395d92654f7b5e441c41e16e5d9d3f704d
parente01593d65cccc1214b34c2c501327f92eb4fa4c7
Emit error when type param declaration shadows global type name

Summary:
```
class T<T> {}
```
is banned by this diff. Notably, type parameter names do not go into the naming table. We're treating type parameter declarations like inline class definitions that live for the scope of the type parameter.

Reviewed By: oulgen

Differential Revision: D13868710

fbshipit-source-id: 823d931d0f3e9159e7d7c2aee4b29f4e3dfa5018
hphp/hack/src/naming/naming.ml
hphp/hack/test/typecheck/constraints/refl_subtype.php.exp
hphp/hack/test/typecheck/instanceof/instanceof_generic_bad.php.exp
hphp/hack/test/typecheck/instanceof/instanceof_generic_bad2.php.exp
hphp/hack/test/typecheck/new_generic_bad.php.exp
hphp/hack/test/typecheck/reified_generics/tparams_shadow_classes.php [new file with mode: 0644]
hphp/hack/test/typecheck/reified_generics/tparams_shadow_classes.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/reified_generics/tparams_shadow_classes_namespaced.php [new file with mode: 0644]
hphp/hack/test/typecheck/reified_generics/tparams_shadow_classes_namespaced.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/shape/shape_unification_missing_optional_fields.php
hphp/hack/test/typecheck/shape_remove_key7.php