File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Expand file tree Collapse file tree 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 {
190190 }
191191 v .lhs = append (v .lhs , lhs .Pointer ())
192192 }
193- if canAddr (rhs ) && ! isEmptyMapOrSlice (lhs ) {
193+ if canAddr (rhs ) && ! isEmptyMapOrSlice (rhs ) {
194194 if inPointers (v .rhs , rhs ) {
195195 return ErrCyclic
196196 }
Original file line number Diff line number Diff line change @@ -616,6 +616,9 @@ func TestCircular(t *testing.T) {
616616 0 : "foo" ,
617617 },
618618 },
619+ 1 : []interface {}{
620+ "bar" , "baz" ,
621+ },
619622 }
620623 emptySlice := map [int ]interface {}{
621624 0 : []interface {}{},
@@ -644,6 +647,8 @@ func TestCircular(t *testing.T) {
644647 {lhs : first , rhs : second , wantError : true },
645648 {lhs : first , rhs : notCyclic , wantError : true },
646649 {lhs : notCyclic , rhs : first , wantError : true },
650+ {lhs : notCyclic , rhs : emptySlice , wantError : false },
651+ {lhs : notCyclic , rhs : emptyMap , wantError : false },
647652 {lhs : notCyclic , rhs : notCyclic },
648653 {lhs : emptySlice , rhs : emptySliceNotRepeating },
649654 {lhs : emptySliceNotRepeating , rhs : emptySlice },
You can’t perform that action at this time.
0 commit comments