take into account require class constraints when checking overriding of type constants
commit1cc03ee816e076540df493ea3f5577803a315921
authorFrancesco Zappa Nardelli <fzn@fb.com>
Fri, 19 Aug 2022 14:44:43 +0000 (19 07:44 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 19 Aug 2022 14:44:43 +0000 (19 07:44 -0700)
tree741fea57865ddee0914a24e03ce7bc89a335cb30
parenteda81a35b9a783e567c2fcd18660653e3bfe1ac0
take into account require class constraints when checking overriding of type constants

Summary:
The hierarchy checks for type constants were not taking into account `require class` constraints in traits.  As a consequence if a trait implemented interfaces with conflicting types for a type constant _and_ required a class that resolved the conflict, Hack was incorrectly raising an error on the trait.

This diff ensures that `require class` constraints are taken into account when checking the type constant hierarchies of traits.

Reviewed By: mpu

Differential Revision: D38786863

fbshipit-source-id: ef8b8f9fdcfb16faa9d8c6a8e1a43dd1b7b52bdd
hphp/hack/src/typing/typing_extends.ml
hphp/hack/test/requireclass/typing/requireclass_hierarchy_04.bad.php [new file with mode: 0644]
hphp/hack/test/requireclass/typing/requireclass_hierarchy_04.bad.php.exp [new file with mode: 0644]
hphp/hack/test/requireclass/typing/typeconst_philippe_01.good.php [new file with mode: 0644]
hphp/hack/test/requireclass/typing/typeconst_philippe_01.good.php.exp [new file with mode: 0644]
hphp/hack/test/requireclass/typing/typeconst_philippe_02.good.php [new file with mode: 0644]
hphp/hack/test/requireclass/typing/typeconst_philippe_02.good.php.exp [new file with mode: 0644]