Fix an issue with abstract trait methods
commitc26a3e5e6e42d39e0eb2f6f9dac3326c0a224223
authorGuilherme Ottoni <ottoni@fb.com>
Thu, 15 Sep 2016 21:55:02 +0000 (15 14:55 -0700)
committerHhvm Bot <hhvm-bot-bot@fb.com>
Thu, 15 Sep 2016 22:05:50 +0000 (15 15:05 -0700)
treeb9f0242b9a394e40abb4878b6ca5b20bad2bee57
parent38683965f0fc68f498783761d55972e971c82aaa
Fix an issue with abstract trait methods

Summary:
If a trait declared an abstract method, and it was included in a class with a
non-unique ancestor declaring that method, this was incorrectly triggering an
error saying that the abstract method was trying to override the concrete method
from the ancestor class. This was only an issue with non-unique base classes
because in this case we can't statically determine whether or not the abstract
trait method will be declared.

This diff fixes the issue by properly annotating which methods were imported
from a trait (using the AttrTrait attribute), and then using this to prevent an
abstract method that came from a trait from attempting to override a concrete
method.

Reviewed By: mxw

Differential Revision: D3869226

fbshipit-source-id: 7753ed1c52a4205963c2a04e1b6ca32a25b1d914
hphp/compiler/analysis/class_scope.cpp
hphp/compiler/analysis/emitter.cpp
hphp/compiler/analysis/function_scope.h
hphp/runtime/base/attr.h
hphp/runtime/vm/class.cpp
hphp/runtime/vm/func-inl.h
hphp/runtime/vm/func.h
hphp/test/slow/traits/non-unique-base.php [new file with mode: 0644]
hphp/test/slow/traits/non-unique-base.php.expect [new file with mode: 0644]