Straighten out typedef checking
commit475d253b80bc2d97963b68c25ecdf2998a61ceaa
authorJosh Watzman <jwatzman@fb.com>
Mon, 2 Jun 2014 19:23:11 +0000 (2 12:23 -0700)
committerJoelMarcey <joelm@fb.com>
Mon, 2 Jun 2014 23:15:01 +0000 (2 16:15 -0700)
treeff5a1311d6ae8b747354594931a9f8414d2d1bb9
parent67ed6a75637fb2b1335a2e191b7d58d82b3f75a6
Straighten out typedef checking

Summary: Right now we keep this `seen` map of typedefs we've expanded to check
for circularity. This doesn't work when expanding something like
`TD<TD<int>>` -- that's not necessarily circular, just involves the same
typedef more than once. Instead, track what the toplevel typedef name
is, and carry just that through when checking for circularity.

Fixes #2556 (https://github.com/facebook/hhvm/issues/2556)

Reviewed By: @pikatchu

Differential Revision: D1335495
13 files changed:
hphp/hack/src/typing/nastCheck.ml
hphp/hack/src/typing/typing.ml
hphp/hack/src/typing/typing_check_service.ml
hphp/hack/src/typing/typing_instantiate.ml
hphp/hack/src/typing/typing_subtype.ml
hphp/hack/src/typing/typing_tdef.ml
hphp/hack/src/typing/typing_unify.ml
hphp/hack/src/typing/typing_utils.ml
hphp/hack/test/typecheck/shape11.php.exp
hphp/hack/test/typecheck/typedef10.php.exp
hphp/hack/test/typecheck/typedef11.php.exp
hphp/hack/test/typecheck/typedef16.php [new file with mode: 0644]
hphp/hack/test/typecheck/typedef16.php.exp [copied from hphp/hack/test/typecheck/shape11.php.exp with 100% similarity]