1
0
mirror of https://github.com/golang/go synced 2024-11-23 07:20:06 -07:00

cmd/vet: fix a crash in lostcancel check

Fixes issue 16143

Change-Id: Id9d257aee54d31fbf0d478cb07339729cd9712c0
Reviewed-on: https://go-review.googlesource.com/24325
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Alan Donovan 2016-06-22 10:40:30 -04:00
parent 1f446432dd
commit f2c13d713d
2 changed files with 7 additions and 1 deletions

View File

@ -276,7 +276,7 @@ func callName(info *types.Info, call *ast.CallExpr) string {
return obj.Name()
}
case *ast.SelectorExpr:
if sel, ok := info.Selections[fun]; ok {
if sel, ok := info.Selections[fun]; ok && sel.Kind() == types.MethodVal {
// method call, e.g. "(*testing.common).Fatal"
meth := sel.Obj()
return fmt.Sprintf("(%s).%s",

View File

@ -135,3 +135,9 @@ func _() {
var condition bool
var someInt int
// Regression test for Go issue 16143.
func _() {
var x struct{ f func() }
x.f()
}