digitalmars.D.bugs - [Issue 19975] New: object.opEquals(Object lhs, Object rhs) can skip
- d-bugmail puremagic.com (50/50) Jun 16 2019 https://issues.dlang.org/show_bug.cgi?id=19975
https://issues.dlang.org/show_bug.cgi?id=19975 Issue ID: 19975 Summary: object.opEquals(Object lhs, Object rhs) can skip typeid comparison when !lhs.opEquals(rhs) Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: n8sh.secondary hotmail.com Current: --- bool opEquals(Object lhs, Object rhs) { if (lhs is rhs) return true; if (lhs is null || rhs is null) return false; if (typeid(lhs) is typeid(rhs) || !__ctfe && typeid(lhs).opEquals(typeid(rhs))) { return lhs.opEquals(rhs); } else { return lhs.opEquals(rhs) && rhs.opEquals(lhs); } } --- Suggested: --- bool opEquals(Object lhs, Object rhs) { if (lhs is rhs) return true; if (lhs is null || rhs is null) return false; if (!lhs.opEquals(rhs)) return false; if (typeid(lhs) is typeid(rhs) || !__ctfe && typeid(lhs).opEquals(typeid(rhs))) { return true; } else { return rhs.opEquals(lhs); } } --- --
Jun 16 2019