typechecker: check overrides of trait "private" members
commitac49c72bcdb3ab6e53e235c909fb64092bdb156e
authorEugene Letuchy <eletuchy@fb.com>
Thu, 14 May 2015 20:23:27 +0000 (14 13:23 -0700)
committerhhvm-bot <hhvm-bot@fb.com>
Sat, 16 May 2015 03:00:34 +0000 (15 20:00 -0700)
tree191a18cff293a88584075ddbbc6cfc844fa5ae81
parent5360bea0b58116d5d8bcc635b0ea11e709d04f95
typechecker: check overrides of trait "private" members

Summary: Due to the copy-paste nature of traits at runtime, the typechecker
 changes the ownership of any "private" member inherited from a trait
 via a `chown_privates` call. However, it failed to check that the
 declaration of a property/method in a `use`ing class was consistent
 with that in the trait, allowing a class to reach into (and possibly
 break) the "internal" logic of the trait.

Reviewed By: @int3

Differential Revision: D2074594
hphp/hack/src/typing/typing_defs.ml
hphp/hack/src/typing/typing_extends.ml
hphp/hack/test/typecheck/trait_priv_extends1.php [new file with mode: 0644]
hphp/hack/test/typecheck/trait_priv_extends1.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/trait_priv_extends2.php [new file with mode: 0644]
hphp/hack/test/typecheck/trait_priv_extends2.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/trait_priv_extends3.php [new file with mode: 0644]
hphp/hack/test/typecheck/trait_priv_extends3.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/trait_priv_extends4.php [new file with mode: 0644]
hphp/hack/test/typecheck/trait_priv_extends4.php.exp [new file with mode: 0644]