diff options
author | Dan Scales <danscales@google.com> | 2021-04-02 16:52:58 -0700 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-04-05 15:30:15 +0000 |
commit | a4b8241d97fb180e1b9cb41c4828345c931d1aaf (patch) | |
tree | c38279cd1a5493824af9384b7cd8765cea58a63b /src/cmd/compile/internal/types/identity.go | |
parent | 6ed045b365731e59fcae48de48f1aea7a6304eb3 (diff) | |
download | go-a4b8241d97fb180e1b9cb41c4828345c931d1aaf.tar.gz go-a4b8241d97fb180e1b9cb41c4828345c931d1aaf.zip |
cmd/compile: get rid of Fields in types.Interface, use allMethods in types.Type instead
Confusingly, the set of all methods of an interface is currently set in
Fields field of types.Interface. This is true, even though there is
already an allMethods field (and AllMethods method) of types.Type.
Change so the set of all methods of an interface are stored in
Type.allMethods, and Interface.Fields is removed. Update the comments
for Methods and AllMethods.
Change-Id: Ibc32bafae86831cba62606b079a855690612c759
Reviewed-on: https://go-review.googlesource.com/c/go/+/307209
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types/identity.go')
-rw-r--r-- | src/cmd/compile/internal/types/identity.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/types/identity.go b/src/cmd/compile/internal/types/identity.go index 9bc636d7ff..dde9f51856 100644 --- a/src/cmd/compile/internal/types/identity.go +++ b/src/cmd/compile/internal/types/identity.go @@ -61,11 +61,11 @@ func identical(t1, t2 *Type, cmpTags bool, assumedEqual map[typePair]struct{}) b return true case TINTER: - if t1.NumFields() != t2.NumFields() { + if t1.AllMethods().Len() != t2.AllMethods().Len() { return false } - for i, f1 := range t1.FieldSlice() { - f2 := t2.Field(i) + for i, f1 := range t1.AllMethods().Slice() { + f2 := t2.AllMethods().Index(i) if f1.Sym != f2.Sym || !identical(f1.Type, f2.Type, cmpTags, assumedEqual) { return false } |