www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24233] New: T[].canFind(Nullable!T()) returns true when it

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

          Issue ID: 24233
           Summary: T[].canFind(Nullable!T()) returns true when it used to
                    return false
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

This is a result of the behavioral change that Nullable!T now acts as a range.
(Thanks Herringway!) Previously, the `opEquals` overload would allow `T ==
Nullable!T()` to always be false. Now, instead the overload of `canFind` that
takes a range is selected, to which `Nullable!T()` acts as an empty range, so
that `canFind` is vacuously true.

There is not really anything that can be done about this short of reverting the
`Nullable!T` range change, which would at this point itself be a regression.
Nonetheless, it *is* a regression, so might as well file it.

--
Nov 08 2023