Fix AttrNoOverride* on classes
Summary:
We weren't checking for uniqueness before setting the magic method
no-override flags, which could in theory result in setting them
incorrectly.
eg if there's a single class B which extends A, with two definitions
of A, and a class C which defines a magic getter, and extends B, but
which is incompatible with one of the As, we'll incorrectly set the
no-override bit on B because *one* possible instantiation of B can't
have a magic getter.
I couldn't come up with code that behaves incorrectly, but
<?hh
class A {};
class B extends A {};
class C extends B {
const FOO = 42;
public function __get($n) { echo "getting $n\n"; return 42; }
}
function f(B $b) {
return $b->foo;
}
<<__EntryPoint>>
function main() {
if (false) {
include "bug.inc";
}
var_dump(f(new C));
}
with bug.inc:
<?hh
class A {
const type FOO = int;
};
Gets the wrong flags on B without this diff.
Reviewed By: ricklavoie, alexeyt
Differential Revision:
D15966816
fbshipit-source-id:
4b4a94e7a5107213377849d9e8ae5d9d1f32105e