Check for cyclic class definitions
commitb7664a4f8f63e83559aaf22ca3519c7bd593a782
authorJake Bailey (Hacklang) <jakebailey@fb.com>
Thu, 20 Jun 2019 00:31:20 +0000 (19 17:31 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 20 Jun 2019 00:36:03 +0000 (19 17:36 -0700)
tree6b26f5fa4b991605bf27effa6fc2cc3159991478
parent8aa636d6caf9d0c28a9acff53d047e0731a3f644
Check for cyclic class definitions

Summary:
Reimplement the check for cyclic class definitions using the linearization for shallow_class_decl.

Currently, when we encounter a cyclic definition in Decl_linearize, we simply ignore it (otherwise there is no way to return a finite linearization!). This makes it difficult to detect a cyclic definition solely from looking at the linearization.

After this change, when Decl_linearize detects a cyclic definition, it emits an MRO element with the mro_cyclic option set, containing the names of classes involved in the dependency cycle.

Differential Revision: D15167011

fbshipit-source-id: 961c90260f4419ec9a4ca4427d14dbaa5f7b87eb
hphp/hack/src/decl/decl_defs.ml
hphp/hack/src/decl/decl_linearize.ml
hphp/hack/src/typing/typing_inheritance.ml