Updated staticcheck
This commit is contained in:
25
vendor/honnef.co/go/tools/unused/implements.go
vendored
25
vendor/honnef.co/go/tools/unused/implements.go
vendored
@ -37,43 +37,46 @@ func sameId(obj types.Object, pkg *types.Package, name string) bool {
|
||||
return pkg.Path() == obj.Pkg().Path()
|
||||
}
|
||||
|
||||
func (c *Checker) implements(V types.Type, T *types.Interface) bool {
|
||||
func (g *Graph) implements(V types.Type, T *types.Interface, msV *types.MethodSet) ([]*types.Selection, bool) {
|
||||
// fast path for common case
|
||||
if T.Empty() {
|
||||
return true
|
||||
return nil, true
|
||||
}
|
||||
|
||||
if ityp, _ := V.Underlying().(*types.Interface); ityp != nil {
|
||||
// TODO(dh): is this code reachable?
|
||||
for i := 0; i < T.NumMethods(); i++ {
|
||||
m := T.Method(i)
|
||||
_, obj := lookupMethod(ityp, m.Pkg(), m.Name())
|
||||
switch {
|
||||
case obj == nil:
|
||||
return false
|
||||
return nil, false
|
||||
case !types.Identical(obj.Type(), m.Type()):
|
||||
return false
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
return true
|
||||
return nil, true
|
||||
}
|
||||
|
||||
// A concrete type implements T if it implements all methods of T.
|
||||
ms := c.msCache.MethodSet(V)
|
||||
var sels []*types.Selection
|
||||
for i := 0; i < T.NumMethods(); i++ {
|
||||
m := T.Method(i)
|
||||
sel := ms.Lookup(m.Pkg(), m.Name())
|
||||
sel := msV.Lookup(m.Pkg(), m.Name())
|
||||
if sel == nil {
|
||||
return false
|
||||
return nil, false
|
||||
}
|
||||
|
||||
f, _ := sel.Obj().(*types.Func)
|
||||
if f == nil {
|
||||
return false
|
||||
return nil, false
|
||||
}
|
||||
|
||||
if !types.Identical(f.Type(), m.Type()) {
|
||||
return false
|
||||
return nil, false
|
||||
}
|
||||
|
||||
sels = append(sels, sel)
|
||||
}
|
||||
return true
|
||||
return sels, true
|
||||
}
|
||||
|
2623
vendor/honnef.co/go/tools/unused/unused.go
vendored
2623
vendor/honnef.co/go/tools/unused/unused.go
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user