dmd icon indicating copy to clipboard operation
dmd copied to clipboard

Replace magic hasReturnExp bitflags with fields

Open dkorpel opened this issue 1 year ago • 2 comments

The throw statement and assert(0) ones seem unused.

dkorpel avatar Oct 18 '24 11:10 dkorpel

Thanks for your pull request and interest in making D better, @dkorpel! 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

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

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

dlang-bot avatar Oct 18 '24 11:10 dlang-bot

Oh I see you said that in the opening comment.

thewilsonator avatar Oct 20 '24 01:10 thewilsonator

Hmm. I still think it would be good to leave those in there, DMDaaL might want that. @RazvanN7 ?

thewilsonator avatar Oct 21 '24 04:10 thewilsonator

It has happened in the past that fields that were unused in dmd were actually being used by users of dmdlib. That being said, I'm not sure what the policy should be here. Normally, you should be able to modify the compiler code however you wish, but this means breaking people's code. To a certain extent that's a given (and not a problem, provided that there are alternative ways in which you can obtain the needed information), however, there are situations where the compiler stores some information that is very hard to obtain if one would not have the ability to simply access it (see [1] for an example and its revert [2]).

As a compiler developer, I understand the need to optimize the code as much as possible. As a dmdlib library user I'd wish that the compiler stores as much information as possible so that I can use it. I think that the best way to proceed, generally, is to not delete information that might be useful, even if at a first glance it seems that the compiler is not using it. In this particular case, I will have Vladut I have look - it might be possible that we are using some of the deleted bits in D-scanner.

[1] https://github.com/dlang/dmd/pull/15241 [2] https://github.com/dlang/dmd/pull/16193

RazvanN7 avatar Oct 21 '24 06:10 RazvanN7

Seems like we are not using these fields in the Dscanner port to dmdlib.

RazvanN7 avatar Oct 24 '24 07:10 RazvanN7