bug fix in naming declaration
commitad535916fd49c7db7be1bfeef7ca41ecdb6ea4ad
authorJulien Verlaguet <julienv@fb.com>
Thu, 10 Jul 2014 17:34:19 +0000 (10 10:34 -0700)
committerfacebook-github-bot <githubbot@fb.com>
Thu, 10 Jul 2014 18:00:17 +0000 (10 11:00 -0700)
tree6be2b22332d7e4c723c71ad27d7ca5543fae0e50
parent781e0deac12135e3276e199c08bb04e7151e3f58
bug fix in naming declaration

Summary: During a name collision (on a global symbol, like a class), the name of the
symbol should be bound to the first version of the definition (the one that was
previously there), not the new one (the one that created the collision).
Otherwise it will break the incremental mode.
The incremental logic does the following:
1) remove everything we knew about the declaration
2) redeclare

If after a collision we bind a class name to the new class it will remove
the declaration of the new class (the wrong one) and break.
This bug was likely introduced by the series of diff updating the type-checker
to not stop at the first error.
We use to throw on a naming error and because of that the naming environment was naturally bound
to the first version of the definition.

Reviewed By: @jwatzman

Differential Revision: D1428722
hphp/hack/src/naming/naming.ml