Bug 20624 – [REG2.088] AA access gives wrong deprecation message.

Status
RESOLVED
Resolution
WORKSFORME
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-03-01T19:39:21Z
Last change time
2021-08-22T21:19:32Z
Keywords
industry, rejects-valid
Assigned to
No Owner
Creator
johanengelen

Comments

Comment #0 by johanengelen — 2020-03-01T19:39:21Z
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.
Comment #1 by johanengelen — 2020-07-31T14:39:36Z
Instead of opAssign, the better fix is `aa[s] = Nullable!ulong(value);`.
Comment #2 by razvan.nitu1305 — 2021-08-17T16:31:09Z
I cannot reproduce this with latest master. Closing as WORKSFORME. @Johan please reopen if you have anything else to add.
Comment #3 by johanengelen — 2021-08-22T21:19:32Z
This started working with 2.097. As per the wrong deprecation message, probably this was automatically "fixed" by removing Implicit conversion with alias this.