File tree 2 files changed +6
-1
lines changed
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ func (v *visited) add(lhs, rhs reflect.Value) error {
190
190
}
191
191
v .lhs = append (v .lhs , lhs .Pointer ())
192
192
}
193
- if canAddr (rhs ) && ! isEmptyMapOrSlice (lhs ) {
193
+ if canAddr (rhs ) && ! isEmptyMapOrSlice (rhs ) {
194
194
if inPointers (v .rhs , rhs ) {
195
195
return ErrCyclic
196
196
}
Original file line number Diff line number Diff line change @@ -616,6 +616,9 @@ func TestCircular(t *testing.T) {
616
616
0 : "foo" ,
617
617
},
618
618
},
619
+ 1 : []interface {}{
620
+ "bar" , "baz" ,
621
+ },
619
622
}
620
623
emptySlice := map [int ]interface {}{
621
624
0 : []interface {}{},
@@ -644,6 +647,8 @@ func TestCircular(t *testing.T) {
644
647
{lhs : first , rhs : second , wantError : true },
645
648
{lhs : first , rhs : notCyclic , wantError : true },
646
649
{lhs : notCyclic , rhs : first , wantError : true },
650
+ {lhs : notCyclic , rhs : emptySlice , wantError : false },
651
+ {lhs : notCyclic , rhs : emptyMap , wantError : false },
647
652
{lhs : notCyclic , rhs : notCyclic },
648
653
{lhs : emptySlice , rhs : emptySliceNotRepeating },
649
654
{lhs : emptySliceNotRepeating , rhs : emptySlice },
You can’t perform that action at this time.
0 commit comments