Permalink
Browse files

Fix incorrect verification of same-named trait methods

Summary:
A trait method with the same name as the trait is not a constructor,
and shouldn't be checked as one (eg a static method with the same name
as the trait should not be an error).

Reviewed By: ricklavoie

Differential Revision: D6768328

fbshipit-source-id: 8a9b82e29f31c1861843f46464c0b40df3774d12
  • Loading branch information...
markw65 authored and hhvm-bot committed Jan 20, 2018
1 parent 95079fc commit 4e2744f16132624a33ff0c208882fafd84636425
Showing with 2 additions and 1 deletion.
  1. +2 −1 hphp/runtime/vm/verifier/check-unit.cpp
@@ -269,7 +269,8 @@ bool UnitChecker::checkPreClasses() {
std::transform(className.begin(), className.end(), className.begin(),
::tolower);
if (name == std::string("__construct") || name == className) {
if (name == std::string("__construct") ||
(name == className && !(classAttrs & AttrTrait))) {
ok &= checkStructor(method, preclass.get());
}

0 comments on commit 4e2744f

Please sign in to comment.