type go/types.Func
112 uses
go/types (current package)
builtins.go#L730: case *Func:
call.go#L753: case *Func:
call.go#L842: if m, _ := obj.(*Func); m != nil {
call.go#L848: m, _ := obj.(*Func)
call.go#L905: case *Func:
check.go#L190: methods map[*TypeName][]*Func // maps package scope type names to associated non-blank (non-interface) methods
decl.go#L147: case *Func:
decl.go#L192: case *Func:
decl.go#L257: case *Func:
decl.go#L820: _ = alt.(*Func)
decl.go#L834: func (check *Checker) funcDecl(obj *Func, decl *declInfo) {
errsupport.go#L89: case *Func:
initorder.go#L256: if _, ok := n.obj.(*Func); ok {
interface.go#L19: methods []*Func // ordered list of explicitly declared methods
interface.go#L39: func NewInterface(methods []*Func, embeddeds []*Named) *Interface {
interface.go#L53: func NewInterfaceType(methods []*Func, embeddeds []Type) *Interface {
interface.go#L98: func (t *Interface) ExplicitMethod(i int) *Func { return t.methods[i] }
interface.go#L117: func (t *Interface) Method(i int) *Func { return t.typeSet().Method(i) }
iter.go#L20: func (t *Interface) Methods() iter.Seq[*Func] {
iter.go#L21: return func(yield func(m *Func) bool) {
iter.go#L34: func (t *Interface) ExplicitMethods() iter.Seq[*Func] {
iter.go#L35: return func(yield func(m *Func) bool) {
iter.go#L60: func (t *Named) Methods() iter.Seq[*Func] {
iter.go#L61: return func(yield func(m *Func) bool) {
lookup.go#L64: if _, ok := obj.(*Func); ok {
lookup.go#L219: if f, _ := obj.(*Func); f != nil {
lookup.go#L324: func MissingMethod(V Type, T *Interface, static bool) (method *Func, wrongType bool) {
lookup.go#L337: func (check *Checker) missingMethod(V, T Type, static bool, equivalent func(x, y Type) bool, cause *string) (method *Func, wrongType bool) {
lookup.go#L355: var m *Func // method on T we're trying to implement
lookup.go#L356: var f *Func // method on V, if found (state is one of ok, wrongName, wrongSig)
lookup.go#L390: f, _ = obj.(*Func)
lookup.go#L404: f, _ = obj.(*Func)
lookup.go#L529: func (check *Checker) funcString(f *Func, pkgInfo bool) string {
lookup.go#L625: func methodIndex(methods []*Func, pkg *Package, name string, foldCase bool) (int, *Func) {
methodset.go#L218: func (s methodSet) add(list []*Func, index []int, indirect bool, multiples bool) methodSet {
methodset.go#L228: func (s methodSet) addOne(f *Func, index []int, indirect bool, multiples bool) methodSet {
named.go#L131: methods []*Func
named.go#L134: loader func(*Named) (tparams []*TypeParam, underlying Type, methods []*Func)
named.go#L158: func NewNamed(obj *TypeName, underlying Type, methods []*Func) *Named {
named.go#L243: func (check *Checker) newNamed(obj *TypeName, underlying Type, methods []*Func) *Named {
named.go#L358: func (t *Named) Method(i int) *Func {
named.go#L373: t.methods = make([]*Func, len(orig.methods))
named.go#L394: func (t *Named) expandMethod(i int) *Func {
named.go#L470: func (t *Named) AddMethod(m *Func) {
named.go#L608: func (n *Named) lookupMethod(pkg *Package, name string, foldCase bool) (int, *Func) {
object.go#L299: func _NewTypeNameLazy(pos token.Pos, pkg *Package, name string, load func(named *Named) (tparams []*TypeParam, underlying Type, methods []*Func)) *TypeName {
object.go#L389: type Func struct {
object.go#L392: origin *Func // if non-nil, the Func from which this one was instantiated
object.go#L397: func NewFunc(pos token.Pos, pkg *Package, name string, sig *Signature) *Func {
object.go#L407: return &Func{object{nil, pos, pkg, name, typ, 0, colorFor(typ), nopos}, false, nil}
object.go#L411: func (obj *Func) Signature() *Signature {
object.go#L428: func (obj *Func) FullName() string {
object.go#L437: func (obj *Func) Scope() *Scope { return obj.typ.(*Signature).scope }
object.go#L446: func (obj *Func) Origin() *Func {
object.go#L457: func (obj *Func) Pkg() *Package { return obj.object.Pkg() }
object.go#L460: func (obj *Func) hasPtrRecv() bool {
object.go#L478: func (*Func) isDependency() {} // a function may be a dependency of an initialization expression
object.go#L537: case *Func:
object.go#L639: func (obj *Func) String() string { return ObjectString(obj, nil) }
object.go#L644: func writeFuncName(buf *bytes.Buffer, f *Func, qf Qualifier) {
resolver.go#L231: obj *Func // method
resolver.go#L492: check.methods = make(map[*TypeName][]*Func)
selection.go#L100: sig := *s.obj.(*Func).typ.(*Signature)
selection.go#L111: sig := *s.obj.(*Func).typ.(*Signature)
subst.go#L332: func (subst *subster) func_(f *Func) *Func {
subst.go#L341: func cloneFunc(f *Func, typ Type) *Func {
subst.go#L361: func replaceRecvType(in []*Func, old, new Type) (out []*Func, copied bool) {
subst.go#L370: out = make([]*Func, len(in))
typeset.go#L30: methods []*Func // all methods of the interface; sorted by unique ID
typeset.go#L59: func (s *_TypeSet) Method(i int) *Func { return s.methods[i] }
typeset.go#L62: func (s *_TypeSet) LookupMethod(pkg *Package, name string, foldCase bool) (int, *Func) {
typeset.go#L221: var allMethods []*Func
typeset.go#L222: mpos := make(map[*Func]token.Pos) // method specification or method embedding position, for good error messages
typeset.go#L223: addMethod := func(pos token.Pos, m *Func, explicit bool) {
typeset.go#L232: err.addf(atPos(mpos[other.(*Func)]), "other declaration of method %s", m.name)
typeset.go#L246: err.addf(atPos(mpos[other.(*Func)]), "other declaration of method %s", m.name)
typeset.go#L351: func compareFunc(a, b *Func) int {
typeset.go#L355: func sortMethods(list []*Func) {
typeset.go#L359: func assertSortedMethods(list []*Func) {
typexpr.go#L130: case *Func:
unify.go#L516: ymap := make(map[string]*Func, len(ymethods))
unify.go#L543: if ym, _ := obj.(*Func); ym == nil || !u.nify(xm.typ, ym.typ, exact, p) {
universe.go#L131: ityp := &Interface{methods: []*Func{err}, complete: true}
golang.org/x/exp/apidiff
apidiff.go#L132: case *types.Func:
apidiff.go#L134: case *types.Func:
apidiff.go#L178: case *types.Func:
compatibility.go#L127: func unexportedMethod(t *types.Interface) *types.Func {
correspondence.go#L259: func (d *differ) sortedMethods(iface *types.Interface) []*types.Func {
correspondence.go#L260: ms := make([]*types.Func, iface.NumMethods())
correspondence.go#L268: func (d *differ) methodID(m *types.Func) string {
messageset.go#L58: if f, ok := obj.(*types.Func); ok {
golang.org/x/tools/go/types/objectpath
objectpath.go#L250: case *types.Func:
objectpath.go#L358: func (enc *Encoder) concreteMethod(meth *types.Func) (Path, bool) {
objectpath.go#L465: seenMethods map[*types.Func]bool // for cycle breaking through recursive interfaces
objectpath.go#L535: f.seenMethods = make(map[*types.Func]bool)
golang.org/x/tools/go/types/typeutil
callee.go#L36: func StaticCallee(info *types.Info, call *ast.CallExpr) *types.Func {
callee.go#L38: fn, _ := obj.(*types.Func)
callee.go#L82: func interfaceMethod(f *types.Func) bool {
golang.org/x/tools/internal/gcimporter
iexport.go#L716: case *types.Func:
iimport.go#L952: methods := make([]*types.Func, r.uint64())
iimport.go#L954: var method *types.Func
iimport.go#L956: method, _ = r.objectPathObject().(*types.Func)
ureader_yes.go#L413: methods := make([]*types.Func, r.Len())
ureader_yes.go#L570: methods := make([]*types.Func, iface.NumExplicitMethods())
ureader_yes.go#L717: func (r *reader) method() *types.Func {
golang.org/x/tools/internal/typesinternal
classify_call.go#L78: case *types.Func:
classify_call.go#L137: func interfaceMethod(f *types.Func) bool