www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19136] New: is expressions don't work as documented


          Issue ID: 19136
           Summary: is expressions don't work as documented
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

The docs say:

is ( Type Identifier : TypeSpecialization )
The condition is satisfied if Type is the same as TypeSpecialization, or if
Type is a class and TypeSpecialization is a base class or base interface of it.
The Identifier is declared to be either an alias of the TypeSpecialization or,
if TypeSpecialization is dependent on Identifier, the deduced type.

So, if we have Type = int and TypeSpecialization = long, we would expect the
result to be false, because int != long and neither are classes or interfaces.
But the result is actually true.

Furthermore, Indentifier is set to int, whereas the docs say that Identifier
should be an alias of TypeSpecialization, long in this case.

Aug 02 2018