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

@@ -44,9 +44,6 @@ func (ns *Namespace) Complement(seqs ...interface{}) (interface{}, error) {
sl := reflect.MakeSlice(v.Type(), 0, 0)
for i := 0; i < v.Len(); i++ {
ev, _ := indirectInterface(v.Index(i))
if !ev.Type().Comparable() {
return nil, errors.New("elements in complement must be comparable")
}
if _, found := aset[normalize(ev)]; !found {
sl = reflect.Append(sl, ev)
}