Commit f2c13d71 authored by Alan Donovan's avatar Alan Donovan

cmd/vet: fix a crash in lostcancel check

Fixes issue 16143

Change-Id: Id9d257aee54d31fbf0d478cb07339729cd9712c0
Reviewed-on: https://go-review.googlesource.com/24325Reviewed-by: default avatarRob Pike <r@golang.org>
parent 1f446432
......@@ -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",
......
......@@ -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()
}
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