Support unComparable args of uniq/complement/in

Fixes #6105
This commit is contained in:
satotake
2020-03-09 21:32:38 +09:00
committed by GitHub
parent c4fa2f0799
commit 8279d2e227
6 changed files with 30 additions and 24 deletions

View File

@@ -48,10 +48,8 @@ func (ns *Namespace) SymDiff(s2, s1 interface{}) (interface{}, error) {
for i := 0; i < v.Len(); i++ {
ev, _ := indirectInterface(v.Index(i))
if !ev.Type().Comparable() {
return nil, errors.New("symdiff: elements must be comparable")
}
key := normalize(ev)
// Append if the key is not in their intersection.
if ids1[key] != ids2[key] {
v, err := convertValue(ev, sliceElemType)