File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Sources/CustomDump/Internal Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ extension Mirror {
2727}
2828
2929func isMirrorEqual( _ lhs: Any , _ rhs: Any ) -> Bool {
30+ let lhsType = type ( of: lhs)
31+ if lhsType is AnyClass , lhsType == type ( of: rhs) , lhs as AnyObject === rhs as AnyObject {
32+ return true
33+ }
3034 guard let lhs = lhs as? any Equatable else {
3135 let lhsMirror = Mirror ( customDumpReflecting: lhs)
3236 let rhsMirror = Mirror ( customDumpReflecting: rhs)
Original file line number Diff line number Diff line change @@ -1290,6 +1290,19 @@ final class DiffTests: XCTestCase {
12901290 """
12911291 )
12921292 }
1293+
1294+ func testRecursion( ) {
1295+ class Object {
1296+ var child : Object ?
1297+ }
1298+ let object = Object ( )
1299+ object. child = object
1300+ expectNoDifference (
1301+ diff ( object, object) ,
1302+ """
1303+ """
1304+ )
1305+ }
12931306}
12941307
12951308private class Shared : _CustomDiffObject , Equatable {
You can’t perform that action at this time.
0 commit comments