Commit 67295d6e authored by Robert Griesemer's avatar Robert Griesemer

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/83918Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent 75f0ad70
......@@ -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)
......
......@@ -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
)
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment