Final private method in trait overridden by a child class of the using class is not caught by hh_client
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
After doing some work on this, I kinda think we should ban it on traits too. If we only ban final private methods on classes, hh will still accept this code that HHVM rejects:
trait MyTrait {
public function foo(): void { $this->bar(); }
final private function bar(): void {}
}
class MyClass {
use MyTrait;
}
class MyChild extends MyClass {
private function bar(): void {}
}
@lexidor do you have any opinions here?
Originally posted by @Wilfred in https://github.com/facebook/hhvm/issues/8805#issuecomment-845579117
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no source files or tests. Start by reproducing the trait example with hh_client and HHVM, then trace the existing check for final private methods on classes. Done means the agreed trait behavior is documented by a regression test and hh_client no longer accepts code that HHVM rejects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100