mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: confusing error if composite literal field is a method
When looking for the field specified in a composite literal, check that the specified name is actually a field and not a method. Fixes #29855. Change-Id: Id77666e846f925907b1eec64213b1d25af8a2466 Reviewed-on: https://go-review.googlesource.com/c/158938 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
c6e47069af
commit
6d781decad
5 changed files with 29 additions and 6 deletions
|
|
@ -375,7 +375,7 @@ func methods(t *types.Type) []*Sig {
|
|||
// generating code if necessary.
|
||||
var ms []*Sig
|
||||
for _, f := range mt.AllMethods().Slice() {
|
||||
if f.Type.Etype != TFUNC || f.Type.Recv() == nil {
|
||||
if !f.IsMethod() {
|
||||
Fatalf("non-method on %v method %v %v\n", mt, f.Sym, f)
|
||||
}
|
||||
if f.Type.Recv() == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue