www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17206] New: Checks that opEquals and toHash are both defined

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

          Issue ID: 17206
           Summary: Checks that opEquals and toHash are both defined or
                    neither are defined
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greeenify gmail.com

There's a Dscanner check for this:

std/range/package.d(5748:12)[warn]: 'Cyclic' has method 'opEquals', but not
'toHash'.
std/internal/test/dummyrange.d(363:8)[warn]: 'TestFoo' has method 'opEquals',
but not 'toHash'.
std/random.d(251:8)[warn]: 'LinearCongruentialEngine' has method 'opEquals',
but not 'toHash'.
std/random.d(995:8)[warn]: 'XorshiftEngine' has method 'opEquals', but not
'toHash'.
std/datetime.d(9240:8)[warn]: 'Date' has method 'opCmp', but not 'opEquals'.
std/datetime.d(13548:8)[warn]: 'TimeOfDay' has method 'opCmp', but not
'opEquals'.
std/datetime.d(14822:8)[warn]: 'DateTime' has method 'opCmp', but not
'opEquals'.
std/datetime.d(31723:14)[warn]: 'StopWatch' has method 'opEquals', but not
'toHash'.
std/complex.d(99:8)[warn]: 'Complex' has method 'opEquals', but not 'toHash'.
std/array.d(162:12)[warn]: 'Foo' has method 'opEquals', but not 'toHash'.
std/functional.d(466:12)[warn]: 'Foo' has method 'opEquals', but not 'toHash'.
std/container/rbtree.d(738:13)[warn]: 'RedBlackTree' has method 'opEquals', but
not 'toHash'.
std/container/array.d(249:8)[warn]: 'Array' has method 'opEquals', but not
'toHash'.
std/container/dlist.d(170:8)[warn]: 'DList' has method 'opEquals', but not
'toHash'.
std/container/slist.d(54:8)[warn]: 'SList' has method 'opEquals', but not
'toHash'.
std/numeric.d(149:8)[warn]: 'CustomFloat' has method 'opCmp', but not
'opEquals'.
std/json.d(101:8)[warn]: 'JSONValue' has method 'opEquals', but not 'toHash'.
std/socket.d(1486:7)[warn]: 'InternetAddress' has method 'opEquals', but not
'toHash'.
std/algorithm/searching.d(3235:19)[warn]: 'S2' has method 'opEquals', but not
'toHash'.
std/uni.d(1205:8)[warn]: 'PackedArrayViewImpl' has method 'opEquals', but not
'toHash'.
std/uni.d(1361:16)[warn]: 'SliceOverIndexed' has method 'opEquals', but not
'toHash'.
std/uni.d(1899:15)[warn]: 'CodepointInterval' has method 'opEquals', but not
'toHash'.
std/uni.d(3095:8)[warn]: 'CowArray' has method 'opEquals', but not 'toHash'.

--
Feb 20