]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix detection of calls to reflect.Method
authorRobert Griesemer <gri@golang.org>
Wed, 14 Jun 2017 21:03:46 +0000 (14:03 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 14 Jun 2017 21:57:56 +0000 (21:57 +0000)
commitcabf622da864740fdc8b692ee2b8812f15e8a8bd
tree15e68317c923ab145b07d327cc5a7569e89e20cf
parent952ecbe0a27aadd184ca3e2c342beb464d6b1653
cmd/compile: fix detection of calls to reflect.Method

The existing code used Type.String() to obtain the name of a type;
specifically type reflect.Method in this case. However, Type.String()
formatting is intended for error messages and uses the format
pkgpath.name instead of pkgname.name if a package (in this case
package reflect) is imported multiple times. As a result, the
reflect.Method type detection failed under peculiar circumstances
(see the included test case).

Thanks to https://github.com/ericlagergren for tracking down
an easy way to make the bug disappear (which in turn directly
led to the underlying cause).

Fixes #19028.

Change-Id: I1b9c5dfd183260a9be74969fe916a94146fc36da
Reviewed-on: https://go-review.googlesource.com/45777
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/walk.go
test/fixedbugs/issue19028.dir/a.go [new file with mode: 0644]
test/fixedbugs/issue19028.dir/main.go [new file with mode: 0644]
test/fixedbugs/issue19028.go [new file with mode: 0644]