www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20624] New: [REG2.088] AA access gives wrong deprecation

https://issues.dlang.org/show_bug.cgi?id=20624

          Issue ID: 20624
           Summary: [REG2.088] AA access gives wrong deprecation message.
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

The following code gives a wrong deprecation message since DMD 2.088:

```
import std.typecons;

alias T = Nullable!ulong;
T normal;
T[4] array;
T[string] aa;

void g(string s, ulong value) {
    normal = value; // no problem
    array[0] = value; // no problem

    aa[s] = value;
    // Should directly use opAssign. Instead gives wrong deprecation message:
    // std.typecons.Nullable!ulong.Nullable.get_ is deprecated - Implicit
conversion with alias Nullable.get this will be removed after 2.096. Please use
.get explicitly.

    aa[s].opAssign(value); // workaround that works without deprecation msg
}

void main() {
    g("hoi", 1);
}
```

The deprecation message is invalid: alias this is never used (because
Nullable.opAssign is directly callable). Moreover, the suggested fix (".get()")
results in wrong code.

--
Mar 01