Make Equals compare by Ref (after comparing TypeRef)

This changes equal to compare by ref. Since computing the ref can be
expensive we first check that the type refs are equal.

Fixes #532
This commit is contained in:
Erik Arvidsson
2015-10-30 12:36:08 -04:00
parent 700ad2d789
commit 30cc7d518f
51 changed files with 167 additions and 489 deletions
+1 -4
View File
@@ -47,10 +47,7 @@ func (s {{.Name}}) InternalImplementation() {{$typesPackage}}Set {
}
func (s {{.Name}}) Equals(other {{$typesPackage}}Value) bool {
if other, ok := other.({{.Name}}); ok {
return s.Ref() == other.Ref()
}
return false
return other != nil && __typeRefFor{{.Name}}.Equals(other.TypeRef()) && s.Ref() == other.Ref()
}
func (s {{.Name}}) Ref() ref.Ref {