Relax restrictions on the typing of class constant shape field names.
commite56def0af4dd11e6f531a12e90e78661a970ddc1
authorMichael Sullivan <msullivan@fb.com>
Thu, 24 Jul 2014 00:30:36 +0000 (23 17:30 -0700)
committerfacebook-github-bot <githubbot@fb.com>
Thu, 24 Jul 2014 01:00:23 +0000 (23 18:00 -0700)
tree60e9a8befe2f009f2d7156882c8a5001202266f2
parentf524f5f603c934ef4481c868482a411092797192
Relax restrictions on the typing of class constant shape field names.

Summary: Relax the restrictions on what types class constants can have when used as shape field names. Previously, they were restricted to being int or string (and not even a type alias for them). We now use the same logic that we use for enum constants, where newtypes are acceptable as long as the actual underlying type is an int or a string. We also have to stop just doing direct structural comparison of types, now that they can be things other than just int and string. We also thread env through more of the related code, now.

Reviewed By: eletuchy, jwatzman

Differential Revision: D1451612
hphp/hack/src/typing/typing.ml
hphp/hack/src/typing/typing_enum.ml
hphp/hack/src/utils/errors.ml
hphp/hack/src/utils/errors.mli
hphp/hack/test/typecheck/shapes_cc_10.php [new file with mode: 0644]
hphp/hack/test/typecheck/shapes_cc_10.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/shapes_cc_7.php.exp
hphp/hack/test/typecheck/shapes_cc_8.php [new file with mode: 0644]
hphp/hack/test/typecheck/shapes_cc_8.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/shapes_cc_9.php [new file with mode: 0644]
hphp/hack/test/typecheck/shapes_cc_9.php.exp [new file with mode: 0644]