Skip to content

Fix Issue 11455 - Overriding template methods should raise a compile …#15350

Merged
RazvanN7 merged 2 commits intodlang:masterfrom
ntrel:tfun-override
Jul 17, 2023
Merged

Fix Issue 11455 - Overriding template methods should raise a compile …#15350
RazvanN7 merged 2 commits intodlang:masterfrom
ntrel:tfun-override

Conversation

@ntrel
Copy link
Copy Markdown
Contributor

@ntrel ntrel commented Jun 26, 2023

…error

@RazvanN7 This implements Improving Error Messages (view)

@dlang-bot
Copy link
Copy Markdown
Contributor

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
11455 normal Overriding template methods should raise a compile error

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#15350"

@RazvanN7
Copy link
Copy Markdown
Contributor

This seems to break Vectorflow:



src/vectorflow/layers.d(476,19): Error: a function template cannot be `override`
--
  | src/vectorflow/neurallayer.d(243,19): Error: a function template cannot be `override`
  | src/vectorflow/neurallayer.d(246,19): Error: a function template cannot be `override`

Comment thread compiler/src/dmd/parse.d Outdated
if (tpl)
{
if (storage_class & STC.override_)
error(loc, "a function template cannot be `override`");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a bit more info would come in handy. Something along the lines of: "Function templates are never virtual, therefore they cannot override anything." and then add an error supplemental stating: "override used to be accepted and ignored on function templates. Please delete the override keyword."

@RazvanN7
Copy link
Copy Markdown
Contributor

Also, maybe we should use a deprecation first. Vectorflow looks unmaintained, I'll raise a PR to fix the failure, but chances are it's gonna get ignored.

@RazvanN7
Copy link
Copy Markdown
Contributor

PR: Netflix/vectorflow#35

@ntrel ntrel marked this pull request as draft June 27, 2023 08:42
@ntrel ntrel marked this pull request as ready for review July 7, 2023 17:03
@RazvanN7 RazvanN7 merged commit a99c9e5 into dlang:master Jul 17, 2023
dkorpel pushed a commit to dkorpel/dmd that referenced this pull request Jul 27, 2023
dlang#15350)

* Fix Issue 11455 - Overriding template methods should raise a compile error

* Change to deprecation; tweak messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

4 participants