]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: sort iface fields before expansion
authorMatthew Dempsky <mdempsky@google.com>
Wed, 2 Jun 2021 01:45:40 +0000 (18:45 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 2 Jun 2021 21:34:56 +0000 (21:34 +0000)
commit498a48327fae3b57e2696322f1ce2b681ccca668
tree05e4cd4f3926a52130bbb78b962b828887de2fda
parentcc52fdd1f3ec9ee24c0a0d6223ac934672c9569c
[dev.typeparams] cmd/compile: sort iface fields before expansion

For toolstash -cmp compatibility with types2, we also need to sort
fields (or at least the embedded types) *before* expanding them. This
is relevant to what position information and parameter names are used
for methods when embedded interfaces have overlapping methods.

This came up in archive/zip, which has:

type fileInfoDirEntry interface {
fs.FileInfo
fs.DirEntry
}

and both of these embedded interfaces in turn have an "IsDir() bool"
method. Traditionally, cmd/compile would keep the method from
fs.FileInfo.IsDir, but with types2 it will now keep fs.DirEntry.IsDir
instead. This doesn't affect correctness at all, but it does end up in
DWARF sometimes.

Change-Id: Iac8d6321894be335466a76b5bf8a0c1b15a3581b
Reviewed-on: https://go-review.googlesource.com/c/go/+/324330
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/types/size.go