Clean up const type inference
commit86523dd91b88c1a337291e55d867045a83c300ad
authorJosh Watzman <jwatzman@fb.com>
Thu, 18 Sep 2014 17:33:40 +0000 (18 10:33 -0700)
committerhhvm-bot <hhvm-bot@fb.com>
Thu, 18 Sep 2014 18:00:15 +0000 (18 11:00 -0700)
tree3ef76dfea1936d7ec2a0831ff05069cbb8f6d51b
parentbee85b12e9ca05178785ac8b5a93deeec048eca9
Clean up const type inference

Summary: Remove duplicated code dealing with infering the type of constants. For
some reason it was doing munging during naming, which we don't need at
all; move the one relevant bit into the other code in declaration. Add a
comment as to why we need special logic here.

Originally to support negative constants:
These are parsed as a unary minus. Fixing here seemed easier
than fixing the parser (which isn't necessarily wrong depending on how
you look at it).

Reviewed By: @int3, @elgenie

Differential Revision: D1559026
hphp/hack/src/naming/naming.ml
hphp/hack/src/typing/typing_decl.ml
hphp/hack/test/typecheck/negative_class_consts.php [new file with mode: 0644]
hphp/hack/test/typecheck/negative_class_consts.php.exp [new file with mode: 0644]