D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20552 - Deprecated Nullable.get warning with Appenders
Summary: Deprecated Nullable.get warning with Appenders
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords: industry, pull
Depends on:
Blocks:
 
Reported: 2020-02-01 06:35 UTC by rbscott
Modified: 2021-01-25 10:35 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description rbscott 2020-02-01 06:35:22 UTC
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/tuczsbvyocxzrejgdrdf@forum.dlang.org.
Comment 1 Mario Kroeplin 2020-10-09 15:27:07 UTC
If you use the "-de" switch, however, the code compiles and no deprecation warnings are shown.
Comment 2 Walter Bright 2020-12-01 07:54:41 UTC
This PR: https://github.com/dlang/dmd/pull/10677 appears to be related.
Comment 3 RazvanN 2021-01-21 14:15:04 UTC
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 Dlang Bot 2021-01-21 15:09:09 UTC
@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 Dlang Bot 2021-01-25 10:35:04 UTC
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