dmd icon indicating copy to clipboard operation
dmd copied to clipboard

Fix 2525: check all parent interfaces for overriden methods

Open ntrel opened this issue 1 year ago • 7 comments

Reboot of #12232.

ntrel avatar Jan 29 '23 12:01 ntrel

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: and Returns:)

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 ⚠️⚠️⚠️

To target stable perform these two steps:

  1. Rebase your branch to upstream/stable:
git rebase --onto upstream/stable upstream/master
  1. Change the base branch of your PR to stable

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"

dlang-bot avatar Jan 29 '23 12:01 dlang-bot

Looks like this still needs some phobos updates.

RazvanN7 avatar Jan 30 '23 11:01 RazvanN7

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)

RazvanN7 avatar Jan 30 '23 11:01 RazvanN7

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 avatar Jan 30 '23 15:01 ntrel

@ntrel What's the status of this?

dkorpel avatar Feb 26 '23 19:02 dkorpel

@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).

MrcSnm avatar Sep 13 '23 21:09 MrcSnm

Sure, unless @ntrel plans to continue this work soon?

dkorpel avatar Sep 15 '23 19:09 dkorpel