New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Issue 20552 - Deprecated Nullable.get warning with Appenders #7759
Conversation
Thanks for your pull request and interest in making D better, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "stable + phobos#7759" |
Isn't it time to remove Ah, "after 2.096". Soon... sooon... impatiently hovers finger over |
Yes, since according to DIP1013:
=>
|
Please don't push to upstream :D
Looking at the release notes, it was deprecated in v2.088.0. So it should go with v2.098.0. However, I have a feeling most (if not all) stakeholders will be happy when this is gone. And non-stakeholders will also be very happy to see an unrelated deprecation message gone. However, the solution brought by @RazvanN7 is simple, can be put into stable (next point release is nearing), so I think this should be merged into stable regardless. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please target stable, and feel free to self-merge.
I've seen this failure on other PRs. I think it is unrelated to this change. |
Since it triggers on all Cirrus workflow, I don't think we should disregard it. EDIT: Could Cirrus be checking out the wrong branch (master instead of stable) ? |
Just a note, the deprecation message says "removed after 2.096", so I would say we should target 2.097. Pushing to 2.098 is not going to make a difference, I would do 2.097, that's what everyone's been reading (over and over and over), and by now if you haven't fixed your Nullable deprecations, you probably won't. (Not for this PR of course, just in general for the removal of the alias this) |
The `ShlexParams` struct contains a `Nullable!string` field: https://github.com/vporton/shlex-dlang/blob/3af05eb6cb31e8ea09386deba5c979694a0c043a/source/shlex.d#L459 `Nullable` got an `opAssign(Nullable)` with 2.095.1 (dlang/phobos#7759), and so does the `ShlexParams` struct. So `__traits(allMembers)` newly returns `opAssign` as well, and the assumption that the passed struct contains data members doesn't hold anymore.
The `ShlexParams` struct contains a `Nullable!string` field: https://github.com/vporton/shlex-dlang/blob/3af05eb6cb31e8ea09386deba5c979694a0c043a/source/shlex.d#L459 `Nullable` got an `opAssign(Nullable)` with 2.095.1 (dlang/phobos#7759), and so does the `ShlexParams` struct. So `__traits(allMembers)` newly returns `opAssign` as well, and the assumption that the passed struct contains data members only doesn't hold anymore.
This PR caused a regression. in the reduced example code:
|
I strongly suspect that your since opAssign overload is a template the opAssign inside the template body does not go through proper overload-resolution and therefore you are trying to call the function created by the template instance. |
Afaics, Compare:
|
This PR causes another regression. For struct types with invariants that contain Nullables, the invariant is now checked, because the fact that Nullable has an opAssign with its own type triggers recursive opAssign generation, which checks the invariants in every containing type. Now that |
Nullable!T
has the following assignment operator:opAssign()(T value)
. ThisopAssign
can be called for bothNullable!T
andT
because of the inneralias get this
of Nullable. However, when a Nullable is assigned to another Nullablea bit copy is preferred rather then an alias this conversion. Despite this,
hasElaborateAssign
specifically calls opAssign thus triggering thealias this
. To bypass this, I used the solution proposed by @FeepingCreature and added an opAssign overload that receives aNullable!T
. This does get rid of the deprecation, however, I don't know how to test this because when compiled with -de, the deprecation does not appear (and phobos is compiled that way). Suggestions?