dmd
dmd copied to clipboard
Fix 2525: check all parent interfaces for overriden methods
Reboot of #12232.
Thanks for your pull request and interest in making D better, @ntrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:
- My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
- My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
- I have provided a detailed rationale explaining my changes
- New or modified functions have Ddoc comments (with
Params:andReturns:)
Please see CONTRIBUTING.md for more information.
If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.
Bugzilla references
| Auto-close | Bugzilla | Severity | Description |
|---|---|---|---|
| ✓ | 2525 | normal | Can't use `override` when implementing abstract base class's interface function |
| ✓ | 21321 | regression | Class with unimplemented interface method compiles, links, then segfaults, if inherited through abstract base class |
⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️
- Regression or critical bug fixes should always target the
stablebranch. Learn more about rebasing tostableor the D release process.
To target stable perform these two steps:
- Rebase your branch to
upstream/stable:
git rebase --onto upstream/stable upstream/master
Testing this PR locally
If you don't have a local development environment setup, you can use Digger to test this PR:
dub run digger -- build "master + dmd#14853"
Looks like this still needs some phobos updates.
Also, is https://issues.dlang.org/show_bug.cgi?id=21321 a dupe of 2525? Is 21321 going to get fixed by this patch? (I assume so)
I don't understand why this triggers another error in phobos:
std/traits.d(5665): Error: function `@safe void std.traits.__unittest_L5602_C7.DerivF.test2()` does not override any function, did you mean to override `@trusted void std.traits.__unittest_L5602_C7.BaseF.test2()`?
That's when overriding an interface method inside a derived interface.
@ntrel What's the status of this?
@dkorpel Could you take a look into that? I know that D people aren't that worried about GC and classes, but I believe the OOP part should be pretty solid by now (specially since having this problem could be a bad surprise from ppl coming from other OOP languages).
Sure, unless @ntrel plans to continue this work soon?