Bug 20552 – Deprecated Nullable.get warning with Appenders

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-02-01T06:35:22Z
Last change time
2021-01-25T10:35:04Z
Keywords
industry, pull
Assigned to
No Owner
Creator
rbscott

Comments

Comment #0 by tjonsies818 — 2020-02-01T06:35:22Z
Migrated over from the dlang forums [1]. You get a deprecation warning when using Nullable members in a struct and an appender. The repro case is pretty simple: ``` import std.array : appender, Appender; import std.typecons : Nullable; struct StructWithNullable { Nullable!(string) nullableString; } void main() { Appender!(StructWithNullable[]) structWithNullableAppender; structWithNullableAppender.put(StructWithNullable.init); } ``` On the playground this prints the following warnings: ``` /dlang/dmd/linux/bin64/../../src/phobos/std/traits.d(3688): Deprecation: function std.typecons.Nullable!string.Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. /dlang/dmd/linux/bin64/../../src/phobos/std/traits.d(3689): Deprecation: function std.typecons.Nullable!string.Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. ``` One challenge is the error doesn't point you to the source of where the problem is occurring, and it can be very difficult to isolate the root cause of the issue. [1] https://forum.dlang.org/post/[email protected].
Comment #1 by kroeplin.d — 2020-10-09T15:27:07Z
If you use the "-de" switch, however, the code compiles and no deprecation warnings are shown.
Comment #2 by bugzilla — 2020-12-01T07:54:41Z
This PR: https://github.com/dlang/dmd/pull/10677 appears to be related.
Comment #3 by razvan.nitu1305 — 2021-01-21T14:15:04Z
Compiling this with git HEAD yields: /home/razvan/dmd/phobos/std/traits.d(3727): Deprecation: function `std.typecons.Nullable!string.Nullable.get_` is deprecated - Implicit conversion with `alias Nullable.get this` will be removed after 2.096. Please use `.get` explicitly. /home/razvan/dmd/druntime/import/core/internal/traits.d(233): instantiated from here: `F!(Nullable!string)` /home/razvan/dmd/phobos/std/meta.d(880): instantiated from here: `anySat!(hasElaborateAssign, Nullable!string)` /home/razvan/dmd/phobos/std/traits.d(3729): instantiated from here: `anySatisfy!(hasElaborateAssign, Nullable!string)` /home/razvan/dmd/druntime/import/core/internal/traits.d(233): ... (5 instantiations, -v to show) ... /home/razvan/dmd/phobos/std/array.d(3468): instantiated from here: `emplaceRef!(StructWithNullable, StructWithNullable, StructWithNullable)` test.d(12): instantiated from here: `put!(StructWithNullable)` Note that the instantion point (test.d(12)) is present in the output, so this is a phobos issue, not a dmd one. Changing component to reflect that.
Comment #4 by dlang-bot — 2021-01-21T15:09:09Z
@RazvanN7 created dlang/phobos pull request #7759 "Fix Issue 20552 - Deprecated Nullable.get warning with Appenders" fixing this issue: - Fix Issue 20552 - Deprecated Nullable.get warning with Appenders https://github.com/dlang/phobos/pull/7759
Comment #5 by dlang-bot — 2021-01-25T10:35:04Z
dlang/phobos pull request #7759 "Fix Issue 20552 - Deprecated Nullable.get warning with Appenders" was merged into stable: - 51bdf472dfb659cddb725cea153f0be103313e32 by RazvanN7: Fix Issue 20552 - Deprecated Nullable.get warning with Appenders https://github.com/dlang/phobos/pull/7759