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:
parent
1f446432dd
commit
f2c13d713d
@ -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",
|
||||
|
6
src/cmd/vet/testdata/lostcancel.go
vendored
6
src/cmd/vet/testdata/lostcancel.go
vendored
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user