On Thursday, 14 October 2021 at 12:43:36 UTC, jfondren wrote:
On Thursday, 14 October 2021 at 11:58:29 UTC, tastyminerals wrote:
Here is an example code that doesn't work with the new compiler anymore:

```
if (someValue.isNull)
```

Attempting to run the above throws:
```
Error: incompatible types for `(0) : (someValue)`: `int` and `Nullable!int`
```


Do you have a complete example? Because this runs without error:

```d
import std.typecons : nullable, Nullable;
import std.stdio : writeln;

void main() {
    auto a = nullable(1);
    auto b = Nullable!int.init;
    if (!a.isNull)
        writeln(a.get);
    if (b.isNull)
        writeln("b is null");
}
```

Steven Schveighoffer was correct, the error was caused by non explicit `someVar;` which had to be changed to `someVar.get;`.

Reply via email to