type go/types.Type
536 uses
go/types (current package)
alias.go#L51: fromRHS Type // RHS of type alias declaration; may be an alias
alias.go#L52: actual Type // actual (aliased) type; never an alias
alias.go#L57: func NewAlias(obj *TypeName, rhs Type) *Alias {
alias.go#L75: func (a *Alias) Underlying() Type { return unalias(a).Underlying() }
alias.go#L98: func (a *Alias) Rhs() Type { return a.fromRHS }
alias.go#L104: func Unalias(t Type) Type {
alias.go#L111: func unalias(a0 *Alias) Type {
alias.go#L115: var t Type
alias.go#L137: func asNamed(t Type) *Named {
alias.go#L144: func (check *Checker) newAlias(obj *TypeName, rhs Type) *Alias {
alias.go#L165: func (check *Checker) newAliasInstance(pos token.Pos, orig *Alias, targs []Type, expanding *Named, ctxt *Context) *Alias {
api.go#L338: func (info *Info) TypeOf(e ast.Expr) Type {
api.go#L385: Type Type
api.go#L447: Type Type
api_predicates.go#L19: func AssertableTo(V *Interface, T Type) bool {
api_predicates.go#L33: func AssignableTo(V, T Type) bool {
api_predicates.go#L44: func ConvertibleTo(V, T Type) bool {
api_predicates.go#L53: func Implements(V Type, T *Interface) bool {
api_predicates.go#L70: func Satisfies(V Type, T *Interface) bool {
api_predicates.go#L88: func Identical(x, y Type) bool {
api_predicates.go#L95: func IdenticalIgnoreTags(x, y Type) bool {
array.go#L13: elem Type
array.go#L18: func NewArray(elem Type, len int64) *Array { return &Array{len: len, elem: elem} }
array.go#L25: func (a *Array) Elem() Type { return a.elem }
array.go#L27: func (a *Array) Underlying() Type { return a }
assignments.go#L24: func (check *Checker) assignment(x *operand, T Type, context string) {
assignments.go#L188: func (check *Checker) lhsVar(lhs ast.Expr) Type {
assignments.go#L282: func operandTypes(list []*operand) (res []Type) {
assignments.go#L290: func varTypes(list []*Var) (res []Type) {
assignments.go#L304: func (check *Checker) typesSummary(list []Type, variadic, hasDots bool) string {
badlinkname.go#L20: func badlinkname_Checker_infer(*Checker, positioner, []*TypeParam, []Type, *Tuple, []*operand, bool, *error_) []Type
basic.go#L84: func (b *Basic) Underlying() Type { return b }
builtins.go#L94: var T Type
builtins.go#L190: if underIs(x.typ, func(u Type) bool {
builtins.go#L234: if !underIs(x.typ, func(u Type) bool {
builtins.go#L252: if !underIs(x.typ, func(u Type) bool {
builtins.go#L328: f := func(typ Type) Type {
builtins.go#L393: var key Type
builtins.go#L394: if !underIs(map_, func(u Type) bool {
builtins.go#L448: f := func(typ Type) Type {
builtins.go#L517: types := []Type{T}
builtins.go#L594: types := make([]Type, nargs)
builtins.go#L643: var params []Type
builtins.go#L645: params = make([]Type, nargs)
builtins.go#L924: func hasVarSize(t Type, seen map[*Named]bool) (varSized bool) {
builtins.go#L965: func (check *Checker) applyTypeFunc(f func(Type) Type, x *operand, id builtinId) Type {
builtins.go#L1004: ptyp := check.newTypeParam(tpar, NewInterfaceType(nil, []Type{NewUnion(terms)})) // assigns type to tpar as a side-effect
builtins.go#L1015: func makeSig(res Type, args ...Type) *Signature {
builtins.go#L1031: func arrayPtrDeref(typ Type) Type {
call.go#L35: func (check *Checker) funcInst(T *target, pos token.Pos, x *operand, ix *indexedExpr, infer bool) ([]Type, []ast.Expr) {
call.go#L48: var targs []Type
call.go#L133: func (check *Checker) instantiateSignature(pos token.Pos, expr ast.Expr, typ *Signature, targs []Type, xlist []ast.Expr) (res *Signature) {
call.go#L262: var targs []Type
call.go#L359: func (check *Checker) genericExprList(elist []ast.Expr) (resList []*operand, targsList [][]Type, xlistList [][]ast.Expr) {
call.go#L393: targsList = [][]Type{targs}
call.go#L421: targsList = make([][]Type, n)
call.go#L462: func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type, xlist []ast.Expr, args []*operand, atargs [][]Type, atxlist [][]ast.Expr) (rsig *Signature) {
call.go#L558: var tmp Type
chan.go#L13: elem Type
chan.go#L27: func NewChan(dir ChanDir, elem Type) *Chan {
chan.go#L35: func (c *Chan) Elem() Type { return c.elem }
chan.go#L37: func (c *Chan) Underlying() Type { return c }
check.go#L232: func (check *Checker) validAlias(alias *TypeName, typ Type) {
check.go#L572: func (check *Checker) recordTypeAndValueInSyntax(x ast.Expr, mode operandMode, typ Type, val constant.Value) {
check.go#L578: func (check *Checker) recordCommaOkTypesInSyntax(x ast.Expr, t0, t1 Type) {
const.go#L76: sizeof := func(T Type) int64 {
const.go#L277: func (check *Checker) invalidConversion(code Code, x *operand, target Type) {
const.go#L289: func (check *Checker) convertUntyped(x *operand, target Type) {
context.go#L48: originIDs map[Type]int // origin type -> unique ID
context.go#L52: orig Type
context.go#L53: targs []Type
context.go#L54: instance Type // = orig[targs]
context.go#L61: originIDs: make(map[Type]int),
context.go#L68: func (ctxt *Context) instanceHash(orig Type, targs []Type) string {
context.go#L90: func (ctxt *Context) lookup(h string, orig Type, targs []Type) Type {
context.go#L111: func (ctxt *Context) update(h string, orig Type, targs []Type, inst Type) Type {
context.go#L137: func (ctxt *Context) getID(t Type) int {
conversions.go#L20: func (check *Checker) conversion(x *operand, T Type) {
conversions.go#L23: constConvertibleTo := func(T Type, val *constant.Value) bool {
conversions.go#L62: ok = underIs(T, func(u Type) bool {
conversions.go#L139: func (x *operand) convertibleTo(check *Checker, T Type, cause *string) bool {
conversions.go#L297: func isUintptr(typ Type) bool {
conversions.go#L302: func isUnsafePointer(typ Type) bool {
conversions.go#L307: func isPointer(typ Type) bool {
conversions.go#L312: func isBytesOrRunes(typ Type) bool {
decl.go#L532: func (check *Checker) isImportedConstraint(typ Type) bool {
decl.go#L547: var rhs Type
decl.go#L688: var bound Type
decl.go#L711: func (check *Checker) bound(x ast.Expr) Type {
errsupport.go#L15: func (check *Checker) lookupError(typ Type, sel string, obj Object, structLit bool) string {
expr.go#L59: type opPredicates map[token.Token]func(Type) bool
expr.go#L230: func (check *Checker) updateExprType(x ast.Expr, typ Type, final bool) {
expr.go#L357: func (check *Checker) implicitTypeAndValue(x *operand, target Type) (Type, constant.Value, Code) {
expr.go#L412: if !underIs(target, func(u Type) bool {
expr.go#L577: func (check *Checker) incomparableCause(typ Type) string {
expr.go#L926: func newTarget(typ Type, desc string) *target {
expr.go#L942: func (check *Checker) rawExpr(T *target, x *operand, e ast.Expr, hint Type, allowGeneric bool) exprKind {
expr.go#L995: func (check *Checker) exprInternal(T *target, x *operand, e ast.Expr, hint Type) exprKind {
expr.go#L1099: var base Type
expr.go#L1100: if !underIs(x.typ, func(u Type) bool {
expr.go#L1207: func (check *Checker) typeAssertion(e ast.Expr, x *operand, T Type, typeSwitch bool) {
expr.go#L1275: func (check *Checker) exprWithHint(x *operand, e ast.Expr, hint Type) {
format.go#L41: case Type:
format.go#L47: case []Type:
gcsizes.go#L15: func (s *gcSizes) Alignof(T Type) (result int64) {
gcsizes.go#L101: func (s *gcSizes) Sizeof(T Type) int64 {
index.go#L109: var key, elem Type // key != nil: we must have all maps
index.go#L112: if underIs(x.typ, func(u Type) bool {
index.go#L114: var k, e Type // k is only set for maps
index.go#L349: func (check *Checker) index(index ast.Expr, max int64) (typ Type, val int64) {
infer.go#L35: func (check *Checker) infer(posn positioner, tparams []*TypeParam, targs []Type, params *Tuple, args []*operand, reverse bool, err *error_) (inferred []Type) {
infer.go#L76: targs2 := make([]Type, n)
infer.go#L119: errorf := func(tpar, targ Type, arg *operand) {
infer.go#L305: if !check.hasAllMethods(tx, constraint, true, func(x, y Type) bool { return u.unify(x, y, exact) }, &cause) {
infer.go#L333: var maxUntyped map[*TypeParam]Type // lazily allocated (we may not need it)
infer.go#L339: maxUntyped = make(map[*TypeParam]Type)
infer.go#L471: func (check *Checker) renameTParams(pos token.Pos, tparams []*TypeParam, typ Type) ([]*TypeParam, Type) {
infer.go#L548: func isParameterized(tparams []*TypeParam, typ Type) bool {
infer.go#L551: seen: make(map[Type]bool),
infer.go#L558: seen map[Type]bool
infer.go#L561: func (w *tpWalker) isParameterized(typ Type) (res bool) {
infer.go#L694: func killCycles(tparams []*TypeParam, inferred []Type) {
infer.go#L695: w := cycleFinder{tparams, inferred, make(map[Type]bool)}
infer.go#L703: inferred []Type
infer.go#L704: seen map[Type]bool
infer.go#L707: func (w *cycleFinder) typ(typ Type) {
instantiate.go#L23: Type
instantiate.go#L55: func Instantiate(ctxt *Context, orig Type, targs []Type, validate bool) (Type, error) {
instantiate.go#L91: func (check *Checker) instance(pos token.Pos, orig genericType, targs []Type, expanding *Named, ctxt *Context) (res Type) {
instantiate.go#L116: updateContexts := func(res Type) Type {
instantiate.go#L212: func (check *Checker) verify(pos token.Pos, tparams []*TypeParam, targs []Type, ctxt *Context) (int, error) {
instantiate.go#L236: func (check *Checker) implements(V, T Type, constraint bool, cause *string) bool {
instantiate.go#L344: var alt Type
instantiate.go#L381: func mentions(T, typ Type) bool {
interface.go#L20: embeddeds []Type // ordered list of explicitly embedded elements
interface.go#L40: tnames := make([]Type, len(embeddeds))
interface.go#L53: func NewInterfaceType(methods []*Func, embeddeds []Type) *Interface {
interface.go#L110: func (t *Interface) EmbeddedType(i int) Type { return t.embeddeds[i] }
interface.go#L147: func (t *Interface) Underlying() Type { return t }
interface.go#L160: addEmbedded := func(pos token.Pos, typ Type) {
interface.go#L201: var recvTyp Type = ityp
iter.go#L47: func (t *Interface) EmbeddedTypes() iter.Seq[Type] {
iter.go#L48: return func(yield func(e Type) bool) {
iter.go#L151: func (l *TypeList) Types() iter.Seq[Type] {
iter.go#L152: return func(yield func(t Type) bool) {
literals.go#L111: func (check *Checker) compositeLit(x *operand, e *ast.CompositeLit, hint Type) {
literals.go#L112: var typ, base Type
literals.go#L281: visited := make(map[any][]Type, len(e.Elts))
literals.go#L353: func (check *Checker) indexedElts(elts []ast.Expr, typ Type, length int64) int64 {
lookup.go#L44: func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (obj Object, index []int, indirect bool) {
lookup.go#L53: func lookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string, foldCase bool) (obj Object, index []int, indirect bool) {
lookup.go#L103: func lookupFieldOrMethodImpl(T Type, addressable bool, pkg *Package, name string, foldCase bool) (obj Object, index []int, indirect bool) {
lookup.go#L236: typ Type
lookup.go#L251: prev := make(map[Type]int) // index at which type was previously seen
lookup.go#L265: func lookupType(m map[Type]int, typ Type) (int, bool) {
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#L488: func (check *Checker) hasAllMethods(V, T Type, static bool, equivalent func(x, y Type) bool, cause *string) bool {
lookup.go#L498: func hasInvalidEmbeddedFields(T Type, seen map[*Struct]bool) bool {
lookup.go#L513: func isInterfacePtr(T Type) bool {
lookup.go#L519: func (check *Checker) interfacePtrError(T Type) string {
lookup.go#L548: func (check *Checker) assertableTo(V, T Type, cause *string) bool {
lookup.go#L564: func (check *Checker) newAssertableTo(V, T Type, cause *string) bool {
lookup.go#L577: func deref(typ Type) (Type, bool) {
lookup.go#L593: func derefStructPtr(typ Type) Type {
map.go#L12: key, elem Type
map.go#L16: func NewMap(key, elem Type) *Map {
map.go#L21: func (m *Map) Key() Type { return m.key }
map.go#L24: func (m *Map) Elem() Type { return m.elem }
map.go#L26: func (t *Map) Underlying() Type { return t }
methodset.go#L72: func NewMethodSet(T Type) *MethodSet {
mono.go#L83: typ Type
mono.go#L176: func (w *monoGraph) recordInstance(pkg *Package, pos token.Pos, tparams []*TypeParam, targs []Type, xlist []ast.Expr) {
mono.go#L187: func (w *monoGraph) assign(pkg *Package, pos token.Pos, tpar *TypeParam, targ Type) {
mono.go#L201: flow := func(src int, typ Type) {
mono.go#L212: var do func(typ Type)
mono.go#L213: do = func(typ Type) {
mono.go#L332: func (w *monoGraph) addEdge(dst, src, weight int, pos token.Pos, typ Type) {
named.go#L116: fromRHS Type
named.go#L123: underlying Type // possibly a *Named during setup; never a *Named once set up completely
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#L261: func (check *Checker) newNamedInstance(pos token.Pos, orig *Named, targs []Type, expanding *Named) *Named {
named.go#L440: var rtyp Type
named.go#L453: func (t *Named) SetUnderlying(underlying Type) {
named.go#L507: func (t *Named) Underlying() Type {
named.go#L538: func (n0 *Named) under() Type {
named.go#L632: func (n *Named) expandUnderlying() Type {
named.go#L708: func safeUnderlying(typ Type) Type {
object.go#L34: Type() Type // object type
object.go#L52: setType(Type)
object.go#L106: typ Type
object.go#L136: func colorFor(t Type) color {
object.go#L158: func (obj *object) Type() Type { return obj.typ }
object.go#L174: func (obj *object) setType(typ Type) { obj.typ = typ }
object.go#L268: func NewConst(pos token.Pos, pkg *Package, name string, typ Type, val constant.Value) *Const {
object.go#L293: func NewTypeName(pos token.Pos, pkg *Package, name string, typ Type) *TypeName {
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#L344: func NewVar(pos token.Pos, pkg *Package, name string, typ Type) *Var {
object.go#L349: func NewParam(pos token.Pos, pkg *Package, name string, typ Type) *Var {
object.go#L356: func NewField(pos token.Pos, pkg *Package, name string, typ Type, embedded bool) *Var {
object.go#L398: var typ Type
operand.go#L62: typ Type
operand.go#L235: func compositeKind(typ Type) string {
operand.go#L312: func (x *operand) assignableTo(check *Checker, T Type, cause *string) (bool, Code) {
pointer.go#L12: base Type // element type
pointer.go#L16: func NewPointer(elem Type) *Pointer { return &Pointer{base: elem} }
pointer.go#L19: func (p *Pointer) Elem() Type { return p.base }
pointer.go#L21: func (p *Pointer) Underlying() Type { return p }
predicates.go#L18: func isValid(t Type) bool { return Unalias(t) != Typ[Invalid] }
predicates.go#L24: func isBoolean(t Type) bool { return isBasic(t, IsBoolean) }
predicates.go#L25: func isInteger(t Type) bool { return isBasic(t, IsInteger) }
predicates.go#L26: func isUnsigned(t Type) bool { return isBasic(t, IsUnsigned) }
predicates.go#L27: func isFloat(t Type) bool { return isBasic(t, IsFloat) }
predicates.go#L28: func isComplex(t Type) bool { return isBasic(t, IsComplex) }
predicates.go#L29: func isNumeric(t Type) bool { return isBasic(t, IsNumeric) }
predicates.go#L30: func isString(t Type) bool { return isBasic(t, IsString) }
predicates.go#L31: func isIntegerOrFloat(t Type) bool { return isBasic(t, IsInteger|IsFloat) }
predicates.go#L32: func isConstType(t Type) bool { return isBasic(t, IsConstType) }
predicates.go#L37: func isBasic(t Type, info BasicInfo) bool {
predicates.go#L48: func allBoolean(t Type) bool { return allBasic(t, IsBoolean) }
predicates.go#L49: func allInteger(t Type) bool { return allBasic(t, IsInteger) }
predicates.go#L50: func allUnsigned(t Type) bool { return allBasic(t, IsUnsigned) }
predicates.go#L51: func allNumeric(t Type) bool { return allBasic(t, IsNumeric) }
predicates.go#L52: func allString(t Type) bool { return allBasic(t, IsString) }
predicates.go#L53: func allOrdered(t Type) bool { return allBasic(t, IsOrdered) }
predicates.go#L54: func allNumericOrString(t Type) bool { return allBasic(t, IsNumeric|IsString) }
predicates.go#L60: func allBasic(t Type, info BasicInfo) bool {
predicates.go#L70: func hasName(t Type) bool {
predicates.go#L81: func isTypeLit(t Type) bool {
predicates.go#L92: func isTyped(t Type) bool {
predicates.go#L101: func isUntyped(t Type) bool {
predicates.go#L107: func isUntypedNumeric(t Type) bool {
predicates.go#L115: func IsInterface(t Type) bool {
predicates.go#L121: func isNonTypeParamInterface(t Type) bool {
predicates.go#L126: func isTypeParam(t Type) bool {
predicates.go#L135: func hasEmptyTypeset(t Type) bool {
predicates.go#L146: func isGeneric(t Type) bool {
predicates.go#L156: func Comparable(T Type) bool {
predicates.go#L162: func comparableType(T Type, dynamic bool, seen map[Type]bool, reportf func(string, ...interface{})) bool {
predicates.go#L167: seen = make(map[Type]bool)
predicates.go#L213: func hasNil(t Type) bool {
predicates.go#L220: return !isTypeParam(t) || underIs(t, func(u Type) bool {
predicates.go#L254: func (c *comparer) identical(x, y Type, p *ifacePair) bool {
predicates.go#L360: var targs []Type
predicates.go#L514: func identicalInstance(xorig Type, xargs []Type, yorig Type, yargs []Type) bool {
predicates.go#L525: func Default(t Type) Type {
predicates.go#L551: func maxType(x, y Type) Type {
recording.go#L21: var typ Type
recording.go#L59: func (check *Checker) recordTypeAndValue(x ast.Expr, mode operandMode, typ Type, val constant.Value) {
recording.go#L132: func (check *Checker) recordInstance(expr ast.Expr, targs []Type, typ Type) {
recording.go#L164: func (check *Checker) recordSelection(x *ast.SelectorExpr, kind SelectionKind, recv Type, obj Object, index []int, indirect bool) {
scope.go#L205: func (*lazyObject) Type() Type { panic("unreachable") }
scope.go#L211: func (*lazyObject) setType(Type) { panic("unreachable") }
selection.go#L77: recv Type // type of x
selection.go#L87: func (s *Selection) Recv() Type { return s.recv }
selection.go#L95: func (s *Selection) Type() Type {
signature.go#L101: func (s *Signature) Underlying() Type { return s }
signature.go#L172: var recvType Type = Typ[Invalid]
signature.go#L261: targs := make([]Type, len(recvTParams))
signature.go#L310: func unpointer(t Type) Type {
signature.go#L330: func (check *Checker) recordParenthesizedRecvTypes(expr ast.Expr, typ Type) {
sizes.go#L17: Alignof(T Type) int64
sizes.go#L27: Sizeof(T Type) int64
sizes.go#L53: func (s *StdSizes) Alignof(T Type) (result int64) {
sizes.go#L117: func _IsSyncAtomicAlign64(T Type) bool {
sizes.go#L167: func (s *StdSizes) Sizeof(T Type) int64 {
sizes.go#L277: func (conf *Config) alignof(T Type) int64 {
sizes.go#L310: func (conf *Config) offsetof(T Type, index []int) int64 {
sizes.go#L329: func (conf *Config) sizeof(T Type) int64 {
slice.go#L12: elem Type
slice.go#L16: func NewSlice(elem Type) *Slice { return &Slice{elem: elem} }
slice.go#L19: func (s *Slice) Elem() Type { return s.elem }
slice.go#L21: func (s *Slice) Underlying() Type { return s }
stmt.go#L231: typ Type
stmt.go#L305: func (check *Checker) caseTypes(x *operand, types []ast.Expr, seen map[Type]ast.Expr) Type {
stmt.go#L306: var T Type
stmt.go#L357: func (check *Checker) caseTypes_currently_unused(x *operand, xtyp *Interface, types []ast.Expr, seen map[string]ast.Expr) Type {
stmt.go#L358: var T Type
stmt.go#L755: seen := make(map[Type]ast.Expr) // map of seen types to positions
stmt.go#L893: var key, val Type
stmt.go#L924: rhs := [2]Type{key, val} // key, val may be nil
stmt.go#L1032: func rangeKeyVal(typ Type, allowVersion func(goVersion) bool) (key, val Type, cause string, ok bool) {
stmt.go#L1033: bad := func(cause string) (Type, Type, string, bool) {
struct.go#L56: func (t *Struct) Underlying() Type { return t }
struct.go#L83: var typ Type
subst.go#L16: type substMap map[*TypeParam]Type
subst.go#L20: func makeSubstMap(tpars []*TypeParam, targs []Type) substMap {
subst.go#L44: func (m substMap) lookup(tpar *TypeParam) Type {
subst.go#L58: func (check *Checker) subst(pos token.Pos, typ Type, smap substMap, expanding *Named, ctxt *Context) Type {
subst.go#L92: func (subst *subster) typ(typ Type) Type {
subst.go#L282: func (subst *subster) typOrNil(typ Type) Type {
subst.go#L298: func cloneVar(v *Var, typ Type) *Var {
subst.go#L341: func cloneFunc(f *Func, typ Type) *Func {
subst.go#L361: func replaceRecvType(in []*Func, old, new Type) (out []*Func, copied bool) {
termlist.go#L132: func (xl termlist) includes(t Type) bool {
tuple.go#L36: func (t *Tuple) Underlying() Type { return t }
type.go#L9: type Type interface {
type.go#L14: Underlying() Type
typelists.go#L31: type TypeList struct{ types []Type }
typelists.go#L34: func newTypeList(list []Type) *TypeList {
typelists.go#L46: func (l *TypeList) At(i int) Type { return l.types[i] }
typelists.go#L51: func (l *TypeList) list() []Type {
typeparam.go#L30: bound Type // any type, but underlying is eventually *Interface for correct programs (see TypeParam.iface)
typeparam.go#L39: func NewTypeParam(obj *TypeName, constraint Type) *TypeParam {
typeparam.go#L44: func (check *Checker) newTypeParam(obj *TypeName, constraint Type) *TypeParam {
typeparam.go#L75: func (t *TypeParam) Constraint() Type {
typeparam.go#L85: func (t *TypeParam) SetConstraint(bound Type) {
typeparam.go#L99: func (t *TypeParam) Underlying() Type {
typeparam.go#L135: ityp = NewInterfaceType(nil, []Type{bound})
typeparam.go#L165: func (t *TypeParam) typeset(yield func(t, u Type) bool) {
typeset.go#L45: func (s *_TypeSet) IsComparable(seen map[Type]bool) bool {
typeset.go#L113: func (s *_TypeSet) typeset(yield func(t, u Type) bool) {
typestring.go#L50: func TypeString(typ Type, qf Qualifier) string {
typestring.go#L59: func WriteType(buf *bytes.Buffer, typ Type, qf Qualifier) {
typestring.go#L72: seen map[Type]bool
typestring.go#L82: return &typeWriter{buf, make(map[Type]bool), qf, nil, nil, true, false, false}
typestring.go#L87: return &typeWriter{buf, make(map[Type]bool), nil, ctxt, nil, false, false, false}
typestring.go#L115: func (w *typeWriter) typ(typ Type) {
typestring.go#L396: func (w *typeWriter) typeList(list []Type) {
typestring.go#L409: var prev Type
typeterm.go#L18: typ Type
typeterm.go#L109: func (x *term) includes(t Type) bool {
typexpr.go#L150: func (check *Checker) typ(e ast.Expr) Type {
typexpr.go#L157: func (check *Checker) varType(e ast.Expr) Type {
typexpr.go#L165: func (check *Checker) validVarType(e ast.Expr, typ Type) {
typexpr.go#L192: func (check *Checker) definedType(e ast.Expr, def *TypeName) Type {
typexpr.go#L210: func (check *Checker) genericType(e ast.Expr, cause *string) Type {
typexpr.go#L226: func goTypeName(typ Type) string {
typexpr.go#L232: func (check *Checker) typInternal(e0 ast.Expr, def *TypeName) (T Type) {
typexpr.go#L238: var under Type
typexpr.go#L418: func setDefType(def *TypeName, typ Type) {
typexpr.go#L433: func (check *Checker) instantiatedType(ix *indexedExpr, def *TypeName) (res Type) {
typexpr.go#L556: func (check *Checker) typeList(list []ast.Expr) []Type {
typexpr.go#L557: res := make([]Type, len(list)) // res != nil even if len(list) == 0
under.go#L14: func under(t Type) Type {
under.go#L23: func underIs(typ Type, f func(Type) bool) bool {
under.go#L25: typeset(typ, func(_, u Type) bool {
under.go#L38: func typeset(t Type, yield func(t, u Type) bool) {
under.go#L52: func coreType(t Type) Type {
under.go#L53: var su Type
under.go#L54: typeset(t, func(_, u Type) bool {
under.go#L75: func coreString(t Type) Type {
under.go#L82: var su Type
under.go#L84: typeset(t, func(_, u Type) bool {
under.go#L115: func match(x, y Type) Type {
unify.go#L82: handles map[*TypeParam]*Type
unify.go#L91: func newUnifier(tparams []*TypeParam, targs []Type, enableInterfaceInference bool) *unifier {
unify.go#L93: handles := make(map[*TypeParam]*Type, len(tparams))
unify.go#L99: var t Type
unify.go#L143: func (u *unifier) unify(x, y Type, mode unifyMode) bool {
unify.go#L213: func (u *unifier) asBoundTypeParam(x Type) *TypeParam {
unify.go#L224: func (u *unifier) setHandle(x *TypeParam, h *Type) {
unify.go#L235: func (u *unifier) at(x *TypeParam) Type {
unify.go#L241: func (u *unifier) set(x *TypeParam, t Type) {
unify.go#L264: func (u *unifier) inferred(tparams []*TypeParam) []Type {
unify.go#L265: list := make([]Type, len(tparams))
unify.go#L274: func asInterface(x Type) (i *Interface) {
unify.go#L285: func (u *unifier) nify(x, y Type, mode unifyMode, p *ifacePair) (result bool) {
union.go#L33: func (u *Union) Underlying() Type { return u }
union.go#L40: func NewTerm(tilde bool, typ Type) *Term { return &Term{tilde, typ} }
union.go#L43: func (t *Term) Type() Type { return t.typ }
union.go#L54: func parseUnion(check *Checker, uexpr ast.Expr) Type {
union.go#L60: var u Type
universe.go#L27: universeBool Type
universe.go#L28: universeByte Type // uint8 alias, but has name "byte"
universe.go#L29: universeRune Type // int32 alias, but has name "rune"
universe.go#L32: universeError Type
validtype.go#L30: func (check *Checker) validType0(pos token.Pos, typ Type, nest, path []*Named) bool {
golang.org/x/exp/apidiff
apidiff.go#L43: correspondMap map[*types.TypeName]types.Type
apidiff.go#L54: correspondMap: map[*types.TypeName]types.Type{},
apidiff.go#L187: func (d *differ) checkCorrespondence(obj types.Object, part string, old, new types.Type) {
apidiff.go#L193: func (d *differ) typeChanged(obj types.Object, part string, old, new types.Type) {
apidiff.go#L204: func removeNamesFromSignature(t types.Type) types.Type {
compatibility.go#L9: func (d *differ) checkCompatible(otn *types.TypeName, old, new types.Type) {
compatibility.go#L261: func (d *differ) checkCompatibleDefined(otn *types.TypeName, old *types.Named, new types.Type) {
compatibility.go#L284: func (d *differ) checkMethodSet(otn *types.TypeName, oldt, newt types.Type, addcompat bool) {
compatibility.go#L334: func exportedMethods(t types.Type) map[string]types.Object {
compatibility.go#L346: func receiverType(method types.Object) types.Type {
correspondence.go#L17: func (d *differ) correspond(old, new types.Type) bool {
correspondence.go#L29: func (d *differ) corr(old, new types.Type, p *ifacePair) bool {
correspondence.go#L159: func (d *differ) establishCorrespondence(old *types.Named, new types.Type) bool {
correspondence.go#L223: func typesEquivalent(old, new types.Type) bool {
golang.org/x/tools/go/types/objectpath
objectpath.go#L457: func find(obj types.Object, T types.Type, path []byte) []byte {
objectpath.go#L468: func (f *finder) find(T types.Type, path []byte) []byte {
objectpath.go#L600: Elem() types.Type
objectpath.go#L617: var t types.Type
golang.org/x/tools/go/types/typeutil
map.go#L40: key types.Type
map.go#L52: func (m *Map) Delete(key types.Type) bool {
map.go#L71: func (m *Map) At(key types.Type) any {
map.go#L84: func (m *Map) Set(key types.Type, value any) (prev any) {
map.go#L128: func (m *Map) Iterate(f func(key types.Type, value any)) {
map.go#L142: func (m *Map) Keys() []types.Type {
map.go#L143: keys := make([]types.Type, 0, m.Len())
map.go#L144: m.Iterate(func(key types.Type, _ any) {
map.go#L157: m.Iterate(func(key types.Type, value any) {
map.go#L186: func hash(t types.Type) uint32 {
map.go#L202: func (h Hasher) Hash(t types.Type) uint32 {
map.go#L222: func (h hasher) hash(t types.Type) uint32 {
map.go#L415: func (h hasher) shallowHash(t types.Type) uint32 {
methodsetcache.go#L20: others map[types.Type]*types.MethodSet // all other types
methodsetcache.go#L28: func (cache *MethodSetCache) MethodSet(T types.Type) *types.MethodSet {
methodsetcache.go#L51: cache.others = make(map[types.Type]*types.MethodSet)
ui.go#L27: func IntuitiveMethodSet(T types.Type, msets *MethodSetCache) []*types.Selection {
ui.go#L28: isPointerToConcrete := func(T types.Type) bool {
golang.org/x/tools/internal/aliases
aliases.go#L28: func NewAlias(enabled bool, pos token.Pos, pkg *types.Package, name string, rhs types.Type, tparams []*types.TypeParam) *types.TypeName {
aliases_go122.go#L15: func Rhs(alias *types.Alias) types.Type {
aliases_go122.go#L16: if alias, ok := any(alias).(interface{ Rhs() types.Type }); ok {
golang.org/x/tools/internal/gcimporter
iexport.go#L365: typIndex: map[types.Type]uint64{},
iexport.go#L598: typIndex map[types.Type]uint64
iexport.go#L966: func (w *exportWriter) typ(t types.Type, pkg *types.Package) {
iexport.go#L980: func (p *iexporter) typOff(t types.Type, pkg *types.Package) uint64 {
iexport.go#L995: func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
iexport.go#L1289: func (w *exportWriter) value(typ types.Type, v constant.Value) {
iexport.go#L1392: func (w *exportWriter) mpint(x *big.Int, typ types.Type) {
iexport.go#L1460: func (w *exportWriter) mpfloat(f *big.Float, typ types.Type) {
iimport.go#L226: typCache: make(map[uint64]types.Type),
iimport.go#L229: tparamIndex: make(map[ident]types.Type),
iimport.go#L366: constraint types.Type
iimport.go#L386: typCache map[uint64]types.Type
iimport.go#L387: tparamIndex map[ident]types.Type
iimport.go#L396: instanceList []types.Type // instances for later completion (see golang/go#61561)
iimport.go#L514: func (p *iimporter) typAt(off uint64, base *types.Named) types.Type {
iimport.go#L539: func canReuse(def *types.Named, rhs types.Type) bool {
iimport.go#L688: func (r *importReader) value() (typ types.Type, val constant.Value) {
iimport.go#L864: func (r *importReader) typ() types.Type {
iimport.go#L868: func isInterface(t types.Type) bool {
iimport.go#L876: func (r *importReader) doType(base *types.Named) (res types.Type) {
iimport.go#L946: embeddeds := make([]types.Type, r.uint64())
iimport.go#L1002: targs := make([]types.Type, len)
predeclared.go#L17: var predecl map[types.Type][]types.Type
predeclared.go#L19: func predeclared() []types.Type {
predeclared.go#L30: predecl = make(map[types.Type][]types.Type)
predeclared.go#L33: decls := []types.Type{ // basic types
predeclared.go#L90: func (t anyType) Underlying() types.Type { return t }
ureader_yes.go#L35: typs []types.Type
ureader_yes.go#L41: laterFors map[types.Type]int
ureader_yes.go#L80: func (pr *pkgReader) laterFor(t types.Type, fn func()) {
ureader_yes.go#L82: pr.laterFors = make(map[types.Type]int)
ureader_yes.go#L105: typs: make([]types.Type, input.NumElems(pkgbits.RelocType)),
ureader_yes.go#L173: derivedTypes []types.Type // lazily instantiated from derived
ureader_yes.go#L295: func (r *reader) typ() types.Type {
ureader_yes.go#L307: func (pr *pkgReader) typIdx(info typeInfo, dict *readerDict) types.Type {
ureader_yes.go#L309: var where *types.Type
ureader_yes.go#L321: var typ types.Type
ureader_yes.go#L339: func (r *reader) doTyp() (res types.Type) {
ureader_yes.go#L414: embeddeds := make([]types.Type, r.Len())
ureader_yes.go#L478: func (r *reader) obj() (types.Object, []types.Type) {
ureader_yes.go#L488: targs := make([]types.Type, r.Len())
ureader_yes.go#L565: setUnderlying := func(underlying types.Type) {
ureader_yes.go#L580: embeds := make([]types.Type, iface.NumEmbeddeds())
ureader_yes.go#L649: dict.derivedTypes = make([]types.Type, len(dict.derived))
ureader_yes.go#L690: typs := make([]types.Type, len(r.dict.bounds))
golang.org/x/tools/internal/typeparams
common.go#L65: func IsTypeParam(t types.Type) bool {
coretype.go#L15: func CoreType(T types.Type) types.Type {
coretype.go#L112: func NormalTerms(T types.Type) ([]*types.Term, error) {
coretype.go#L138: func Deref(t types.Type) types.Type {
coretype.go#L150: func MustDeref(t types.Type) types.Type {
free.go#L19: seen map[types.Type]bool
free.go#L23: func (w *Free) Has(typ types.Type) (res bool) {
free.go#L29: w.seen = make(map[types.Type]bool)
normalize.go#L95: func computeTermSet(typ types.Type) ([]*types.Term, error) {
normalize.go#L96: tset, err := computeTermSetInternal(typ, make(map[types.Type]*termSet), 0)
normalize.go#L127: func computeTermSetInternal(t types.Type, seen map[types.Type]*termSet, depth int) (res *termSet, err error) {
normalize.go#L216: func under(t types.Type) types.Type {
termlist.go#L137: func (xl termlist) includes(t types.Type) bool {
typeterm.go#L22: typ types.Type
typeterm.go#L113: func (x *term) includes(t types.Type) bool {
golang.org/x/tools/internal/typesinternal
element.go#L25: func ForEachElement(rtypes *typeutil.Map, msets *typeutil.MethodSetCache, T types.Type, f func(types.Type)) {
element.go#L26: var visit func(T types.Type, skip bool)
element.go#L27: visit = func(T types.Type, skip bool) {
recv.go#L39: func Unpointer(t types.Type) types.Type {
types.go#L83: func TypeNameFor(t types.Type) *types.TypeName {
types.go#L114: types.Type
zerovalue.go#L34: func ZeroString(t types.Type, qual types.Qualifier) (_ string, isValid bool) {
zerovalue.go#L127: func ZeroExpr(t types.Type, qual types.Qualifier) (_ ast.Expr, isValid bool) {
zerovalue.go#L224: func TypeExpr(t types.Type, qual types.Qualifier) ast.Expr {