Comment #0 by default_357-line — 2021-08-04T07:53:21Z
Consider the following code:
import std.typecons;
struct S
{
int i;
invariant(i != 0);
Nullable!int k;
}
void main() {
S s;
s = S(5);
}
Previously, that invariant was not a problem because "s = S(5)" is a plain copy, because no type in or under S requires generated opAssign.
With DMD 2.095.1, Nullable gained an `opAssign()(Nullable!T)` overload. This means that now, any type that contains a Nullable gets an autogenerated `opAssign` method, which triggers the invariant check.
"Non-init" is a very common invariant in domain-data, and T.init is a very common value in ranges, which frequently reassign fields. So this is rather painful.
Since that opAssign was only added to handle the `get` deprecation and `get` is now removed, maybe it can be reverted?
Comment #1 by dlang-bot — 2021-08-04T08:06:44Z
@FeepingCreature created dlang/phobos pull request #8187 "Fix issue 22176: Revert 51bdf472dfb659cddb725cea153f0be103313e32" fixing this issue:
- Fix issue 22176: Revert 51bdf472dfb659cddb725cea153f0be103313e32
Revert "Fix Issue 20552 - Deprecated Nullable.get warning with Appenders"
`Nullable.get` is removed anyways.
https://github.com/dlang/phobos/pull/8187
Comment #2 by dlang-bot — 2021-08-07T17:12:02Z
dlang/phobos pull request #8187 "Fix issue 22176: Revert #7759 "Deprecated Nullable.get warning with Appenders"" was merged into stable:
- f50a8c17049d3c7b4f9efc547896db086e9899d3 by Mathis Beer:
Fix issue 22176: Revert 51bdf472dfb659cddb725cea153f0be103313e32
Revert "Fix Issue 20552 - Deprecated Nullable.get warning with Appenders"
`Nullable.get` is removed anyways.
https://github.com/dlang/phobos/pull/8187
Comment #3 by dlang-bot — 2021-08-09T22:47:18Z
dlang/phobos pull request #8189 "merge stable" was merged into master:
- f0372ae659edb885598bd2570604e4a1bdeb2fcf by Mathis Beer:
Fix issue 22176: Revert 51bdf472dfb659cddb725cea153f0be103313e32
Revert "Fix Issue 20552 - Deprecated Nullable.get warning with Appenders"
`Nullable.get` is removed anyways.
https://github.com/dlang/phobos/pull/8189