Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 1dc3c3c

Browse files
committed
Merge remote-tracking branch 'upstream/stable' into merge_stable
2 parents bff4d4b + c4bc836 commit 1dc3c3c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/object.d

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3513,6 +3513,11 @@ bool __equals(T1, T2)(T1[] lhs, T2[] rhs)
35133513
if (at(lhs, u) != at(rhs, u))
35143514
return false;
35153515
}
3516+
else static if (__traits(isAssociativeArray, U1))
3517+
{
3518+
if (at(lhs, u) != at(rhs, u))
3519+
return false;
3520+
}
35163521
else
35173522
{
35183523
if (at(lhs, u).tupleof != at(rhs, u).tupleof)
@@ -3565,6 +3570,21 @@ unittest
35653570
assert(arr2 == arr3);
35663571
}
35673572

3573+
// https://issues.dlang.org/show_bug.cgi?id=18252
3574+
unittest
3575+
{
3576+
string[int][] a1, a2;
3577+
assert(__equals(a1, a2));
3578+
assert(a1 == a2);
3579+
a1 ~= [0: "zero"];
3580+
a2 ~= [0: "zero"];
3581+
assert(__equals(a1, a2));
3582+
assert(a1 == a2);
3583+
a2[0][1] = "one";
3584+
assert(!__equals(a1, a2));
3585+
assert(a1 != a2);
3586+
}
3587+
35683588
// Compare class and interface objects for ordering.
35693589
private int __cmp(Obj)(Obj lhs, Obj rhs)
35703590
if (is(Obj : Object))

0 commit comments

Comments
 (0)