mirror of
https://github.com/golang/go
synced 2024-11-19 16:54:44 -07:00
go/types: collect methods with parenthesized receiver types
The existing code simply dropped them on the floor. Don't do that. Fixes #23130. Change-Id: I10f20e41f2c466a76519983253f87af7cf6d5e70 Reviewed-on: https://go-review.googlesource.com/83918 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
75f0ad705f
commit
67295d6eb0
@ -417,9 +417,9 @@ func (check *Checker) collectObjects() {
|
||||
// receiver name. They will be type-checked later, with regular
|
||||
// functions.
|
||||
if list := d.Recv.List; len(list) > 0 {
|
||||
typ := list[0].Type
|
||||
typ := unparen(list[0].Type)
|
||||
if ptr, _ := typ.(*ast.StarExpr); ptr != nil {
|
||||
typ = ptr.X
|
||||
typ = unparen(ptr.X)
|
||||
}
|
||||
if base, _ := typ.(*ast.Ident); base != nil && base.Name != "_" {
|
||||
check.assocMethod(base.Name, obj)
|
||||
|
10
src/go/types/testdata/decls2b.src
vendored
10
src/go/types/testdata/decls2b.src
vendored
@ -63,3 +63,13 @@ func ((*T7)) m3() {}
|
||||
func (x *(T7),) m4() {}
|
||||
func (x (*(T7)),) m5() {}
|
||||
func (x ((*((T7)))),) m6() {}
|
||||
|
||||
// Check that methods with parenthesized receiver are actually present (issue #23130).
|
||||
var (
|
||||
_ = T7.m1
|
||||
_ = T7.m2
|
||||
_ = (*T7).m3
|
||||
_ = (*T7).m4
|
||||
_ = (*T7).m5
|
||||
_ = (*T7).m6
|
||||
)
|
Loading…
Reference in New Issue
Block a user