Skip to content

Conversation

@ntrel
Copy link
Contributor

@ntrel ntrel commented Dec 17, 2025

Set Module.edition in constructor.
Make -edition=YYYYfilename an error as it does nothing (and also wrongly sets params.edition).
Allow a larger -edition value to override a module declaration's edition. (I think this is more useful than erroring). Note: this case is not mentioned in the DIP AFAICT - @atilaneves?

Fixes #22245.

Set `Module.edition` in constructor.
Make `-edition=YYYYfilename` an error as it does nothing (and also
wrongly sets `params.edition`).
Allow a larger `-edition` to override a module declaration's edition.
@dlang-bot
Copy link
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

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

}
mod.edition = cast(Edition)edition;
// ModuleDeclaration edition can't lower -edition flag's edition
if (edition > mod.edition)
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it can lower it.

The edition switch is only for overriding the default edition (D2/legacy).

Copy link
Contributor

Choose a reason for hiding this comment

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

This DIP also recommends a -E switch that allows the user to specify a default target edition for all imported modules in a given path. This target overrides the default edition and the -edition flag, if present, for modules in the given path. An example:

The purpose of the switch is for build managers like dub.

@rikkimax
Copy link
Contributor

I'll repeat myself on the issue.

The behaviour of the edition switch was purposefully decided not to override the module declaration; as-is, this PR cannot be accepted.

@ntrel
Copy link
Contributor Author

ntrel commented Dec 18, 2025

The behaviour of the edition switch was purposefully decided not to override the module declaration

OK, fixed.

@thewilsonator thewilsonator merged commit ee0f3cb into dlang:master Dec 19, 2025
40 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-edition flag semantics not implemented

4 participants