type go/types.Checker
201 uses
go/types (current package)
api.go#L431: return (*Checker)(nil).newAssertableTo(V, T) == nil
api.go#L469: return (*Checker)(nil).implements(V, T) == nil
assignments.go#L20: func (check *Checker) assignment(x *operand, T Type, context string) {
assignments.go#L105: func (check *Checker) initConst(lhs *Const, x *operand) {
assignments.go#L136: func (check *Checker) initVar(lhs *Var, x *operand, context string) Type {
assignments.go#L167: func (check *Checker) assignVar(lhs ast.Expr, x *operand) Type {
assignments.go#L261: func (check *Checker) typesSummary(list []Type, variadic bool) string {
assignments.go#L300: func (check *Checker) assignError(rhs []ast.Expr, nvars, nvals int) {
assignments.go#L316: func (check *Checker) initVars(lhs []*Var, origRHS []ast.Expr, returnStmt ast.Stmt) {
assignments.go#L376: func (check *Checker) assignVars(lhs, origRHS []ast.Expr) {
assignments.go#L409: func (check *Checker) shortVarDecl(pos positioner, lhs, rhs []ast.Expr) {
builtins.go#L20: func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ bool) {
builtins.go#L827: func (check *Checker) applyTypeFunc(f func(Type) Type, x *operand, id builtinId) Type {
call.go#L19: func (check *Checker) funcInst(x *operand, ix *typeparams.IndexExpr) {
call.go#L63: func (check *Checker) instantiateSignature(pos token.Pos, typ *Signature, targs []Type, xlist []ast.Expr) (res *Signature) {
call.go#L97: func (check *Checker) callExpr(x *operand, call *ast.CallExpr) exprKind {
call.go#L244: func (check *Checker) exprList(elist []ast.Expr, allowCommaOk bool) (xlist []*operand, commaOk bool) {
call.go#L288: func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type, args []*operand, xlist []ast.Expr) (rsig *Signature) {
call.go#L432: func (check *Checker) selector(x *operand, e *ast.SelectorExpr, def *Named) {
call.go#L730: func (check *Checker) use(arg ...ast.Expr) {
call.go#L745: func (check *Checker) useLHS(arg ...ast.Expr) {
check.go#L96: type Checker struct {
check.go#L147: func (check *Checker) addDeclDep(to Object) {
check.go#L160: func (check *Checker) brokenAlias(alias *TypeName) {
check.go#L169: func (check *Checker) validAlias(alias *TypeName, typ Type) {
check.go#L175: func (check *Checker) isBrokenAlias(alias *TypeName) bool {
check.go#L179: func (check *Checker) rememberUntyped(e ast.Expr, lhs bool, mode operandMode, typ *Basic, val constant.Value) {
check.go#L194: func (check *Checker) later(f func()) *action {
check.go#L201: func (check *Checker) push(obj Object) int {
check.go#L207: func (check *Checker) pop() Object {
check.go#L221: func (check *Checker) needsCleanup(c cleaner) {
check.go#L227: func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Checker {
check.go#L243: return &Checker{
check.go#L258: func (check *Checker) initFiles(files []*ast.File) {
check.go#L296: func (check *Checker) handleBailout(err *error) {
check.go#L308: func (check *Checker) Files(files []*ast.File) error { return check.checkFiles(files) }
check.go#L312: func (check *Checker) checkFiles(files []*ast.File) (err error) {
check.go#L375: func (check *Checker) processDelayed(top int) {
check.go#L395: func (check *Checker) cleanup() {
check.go#L403: func (check *Checker) record(x *operand) {
check.go#L430: func (check *Checker) recordUntyped() {
check.go#L444: func (check *Checker) recordTypeAndValue(x ast.Expr, mode operandMode, typ Type, val constant.Value) {
check.go#L461: func (check *Checker) recordBuiltinType(f ast.Expr, sig *Signature) {
check.go#L479: func (check *Checker) recordCommaOkTypes(x ast.Expr, a [2]Type) {
check.go#L511: func (check *Checker) recordInstance(expr ast.Expr, targs []Type, typ Type) {
check.go#L539: func (check *Checker) recordDef(id *ast.Ident, obj Object) {
check.go#L546: func (check *Checker) recordUse(id *ast.Ident, obj Object) {
check.go#L554: func (check *Checker) recordImplicit(node ast.Node, obj Object) {
check.go#L562: func (check *Checker) recordSelection(x *ast.SelectorExpr, kind SelectionKind, recv Type, obj Object, index []int, indirect bool) {
check.go#L570: func (check *Checker) recordScope(node ast.Node, scope *Scope) {
conversions.go#L16: func (check *Checker) conversion(x *operand, T Type) {
conversions.go#L129: func (x *operand) convertibleTo(check *Checker, T Type, cause *string) bool {
decl.go#L14: func (check *Checker) reportAltDecl(obj Object) {
decl.go#L23: func (check *Checker) declare(scope *Scope, id *ast.Ident, obj Object, pos token.Pos) {
decl.go#L55: func (check *Checker) objDecl(obj Object, def *Named) {
decl.go#L208: func (check *Checker) validCycle(obj Object) (valid bool) {
decl.go#L304: func (check *Checker) cycleError(cycle []Object) {
decl.go#L367: func (check *Checker) walkDecls(decls []ast.Decl, f func(decl)) {
decl.go#L373: func (check *Checker) walkDecl(d ast.Decl, f func(decl)) {
decl.go#L417: func (check *Checker) constDecl(obj *Const, typ, init ast.Expr, inherited bool) {
decl.go#L463: func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init ast.Expr) {
decl.go#L524: func (check *Checker) isImportedConstraint(typ Type) bool {
decl.go#L533: func (check *Checker) typeDecl(obj *TypeName, tdecl *ast.TypeSpec, def *Named) {
decl.go#L599: func (check *Checker) collectTypeParams(dst **TypeParamList, list *ast.FieldList) {
decl.go#L651: func (check *Checker) bound(x ast.Expr) Type {
decl.go#L674: func (check *Checker) declareTypeParams(tparams []*TypeParam, names []*ast.Ident) []*TypeParam {
decl.go#L695: func (check *Checker) collectMethods(obj *TypeName) {
decl.go#L750: func (check *Checker) checkFieldUniqueness(base *Named) {
decl.go#L778: func (check *Checker) funcDecl(obj *Func, decl *declInfo) {
decl.go#L812: func (check *Checker) declStmt(d ast.Decl) {
errors.go#L29: func (check *Checker) qualifier(pkg *Package) string {
errors.go#L48: func (check *Checker) markImports(pkg *Package) {
errors.go#L67: func (check *Checker) sprintf(format string, args ...any) string {
errors.go#L130: func (check *Checker) trace(pos token.Pos, format string, args ...any) {
errors.go#L139: func (check *Checker) dump(format string, args ...any) {
errors.go#L143: func (check *Checker) err(err error) {
errors.go#L195: func (check *Checker) newError(at positioner, code errorCode, soft bool, msg string) error {
errors.go#L209: func (check *Checker) newErrorf(at positioner, code errorCode, soft bool, format string, args ...any) error {
errors.go#L214: func (check *Checker) error(at positioner, code errorCode, msg string) {
errors.go#L218: func (check *Checker) errorf(at positioner, code errorCode, format string, args ...any) {
errors.go#L222: func (check *Checker) softErrorf(at positioner, code errorCode, format string, args ...any) {
errors.go#L226: func (check *Checker) invalidAST(at positioner, format string, args ...any) {
errors.go#L230: func (check *Checker) invalidArg(at positioner, code errorCode, format string, args ...any) {
errors.go#L234: func (check *Checker) invalidOp(at positioner, code errorCode, format string, args ...any) {
expr.go#L74: func (check *Checker) op(m opPredicates, x *operand, op token.Token) bool {
expr.go#L90: func (check *Checker) overflow(x *operand, op token.Token, opPos token.Pos) {
expr.go#L157: func (check *Checker) unary(x *operand, e *ast.UnaryExpr) {
expr.go#L277: func representableConst(x constant.Value, check *Checker, typ *Basic, rounded *constant.Value) bool {
expr.go#L417: func (check *Checker) representable(x *operand, typ *Basic) {
expr.go#L432: func (check *Checker) representation(x *operand, typ *Basic) (constant.Value, errorCode) {
expr.go#L455: func (check *Checker) invalidConversion(code errorCode, x *operand, target Type) {
expr.go#L475: func (check *Checker) updateExprType(x ast.Expr, typ Type, final bool) {
expr.go#L479: func (check *Checker) updateExprType0(parent, x ast.Expr, typ Type, final bool) {
expr.go#L597: func (check *Checker) updateExprVal(x ast.Expr, val constant.Value) {
expr.go#L605: func (check *Checker) convertUntyped(x *operand, target Type) {
expr.go#L632: func (check *Checker) implicitTypeAndValue(x *operand, target Type) (Type, constant.Value, errorCode) {
expr.go#L732: func (check *Checker) comparison(x, y *operand, op token.Token, switchCase bool) {
expr.go#L855: func (check *Checker) incomparableCause(typ Type) string {
expr.go#L869: func (check *Checker) kindString(typ Type) string {
expr.go#L896: func (check *Checker) shift(x, y *operand, e ast.Expr, op token.Token) {
expr.go#L1062: func (check *Checker) binary(x *operand, e ast.Expr, lhs, rhs ast.Expr, op token.Token, opPos token.Pos) {
expr.go#L1198: func (check *Checker) rawExpr(x *operand, e ast.Expr, hint Type, allowGeneric bool) exprKind {
expr.go#L1221: func (check *Checker) nonGeneric(x *operand) {
expr.go#L1246: func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
expr.go#L1684: func (check *Checker) typeAssertion(e ast.Expr, x *operand, T Type, typeSwitch bool) {
expr.go#L1704: func (check *Checker) expr(x *operand, e ast.Expr) {
expr.go#L1711: func (check *Checker) multiExpr(x *operand, e ast.Expr) {
expr.go#L1720: func (check *Checker) exprWithHint(x *operand, e ast.Expr, hint Type) {
expr.go#L1732: func (check *Checker) exprOrType(x *operand, e ast.Expr, allowGeneric bool) {
expr.go#L1740: func (check *Checker) exclude(x *operand, modeset uint) {
expr.go#L1767: func (check *Checker) singleValue(x *operand) {
index.go#L18: func (check *Checker) indexExpr(x *operand, e *typeparams.IndexExpr) (isFuncInst bool) {
index.go#L209: func (check *Checker) sliceExpr(x *operand, e *ast.SliceExpr) {
index.go#L331: func (check *Checker) singleIndex(expr *typeparams.IndexExpr) ast.Expr {
index.go#L347: func (check *Checker) index(index ast.Expr, max int64) (typ Type, val int64) {
index.go#L376: func (check *Checker) isValidIndex(x *operand, code errorCode, what string, allowNegative bool) bool {
index.go#L415: func (check *Checker) indexedElts(elts []ast.Expr, typ Type, length int64) int64 {
infer.go#L32: func (check *Checker) infer(posn positioner, tparams []*TypeParam, targs []Type, params *Tuple, args []*operand) (result []Type) {
infer.go#L467: func (check *Checker) inferB(posn positioner, tparams []*TypeParam, targs []Type) (types []Type, index int) {
initorder.go#L14: func (check *Checker) initOrder() {
initorder.go#L153: func (check *Checker) reportCycle(cycle []Object) {
instantiate.go#L54: if i, err := (*Checker)(nil).verify(token.NoPos, tparams, targs); err != nil {
instantiate.go#L59: inst := (*Checker)(nil).instance(token.NoPos, orig, targs, ctxt)
instantiate.go#L66: func (check *Checker) instance(pos token.Pos, orig Type, targs []Type, ctxt *Context) (res Type) {
instantiate.go#L124: func (check *Checker) validateTArgLen(pos token.Pos, ntparams, ntargs int) bool {
instantiate.go#L136: func (check *Checker) verify(pos token.Pos, tparams []*TypeParam, targs []Type) (int, error) {
instantiate.go#L156: func (check *Checker) implements(V, T Type) error {
interface.go#L17: check *Checker // for error reporting; nil once type set is computed
interface.go#L59: typ := (*Checker)(nil).newInterface()
interface.go#L77: func (check *Checker) newInterface() *Interface {
interface.go#L158: func (check *Checker) interfaceType(ityp *Interface, iface *ast.InterfaceType, def *Named) {
labels.go#L13: func (check *Checker) labels(body *ast.BlockStmt) {
labels.go#L94: func (check *Checker) blockBranches(all *Scope, parent *block, lstmt *ast.LabeledStmt, list []ast.Stmt) []*ast.BranchStmt {
lookup.go#L295: m, alt := (*Checker)(nil).missingMethod(V, T, static)
lookup.go#L308: func (check *Checker) missingMethod(V Type, T *Interface, static bool) (method, alt *Func) {
lookup.go#L374: func (check *Checker) missingMethodReason(V, T Type, m, alt *Func) string {
lookup.go#L413: func (check *Checker) interfacePtrError(T Type) string {
lookup.go#L422: func (check *Checker) funcString(f *Func) string {
lookup.go#L438: func (check *Checker) assertableTo(V *Interface, T Type) (method, wrongType *Func) {
lookup.go#L452: func (check *Checker) newAssertableTo(V *Interface, T Type) error {
mono.go#L82: func (check *Checker) monomorph() {
mono.go#L117: func (check *Checker) reportInstanceLoop(v int) {
named.go#L14: check *Checker
named.go#L41: return (*Checker)(nil).newNamed(obj, nil, underlying, nil, newMethodList(methods))
named.go#L65: func (check *Checker) newNamed(obj *TypeName, orig *Named, underlying Type, tparams *TypeParamList, methods *methodList) *Named {
named.go#L343: func (check *Checker) bestContext(ctxt *Context) *Context {
operand.go#L234: func (x *operand) assignableTo(check *Checker, T Type, reason *string) (bool, errorCode) {
predicates.go#L283: var check *Checker // ok to call subst on a nil *Checker
resolver.go#L53: func (check *Checker) arityMatch(s, init *ast.ValueSpec) {
resolver.go#L103: func (check *Checker) declarePkgObj(ident *ast.Ident, obj Object, d *declInfo) {
resolver.go#L126: func (check *Checker) filename(fileNo int) string {
resolver.go#L134: func (check *Checker) importPackage(at positioner, path, dir string) *Package {
resolver.go#L210: func (check *Checker) collectObjects() {
resolver.go#L497: func (check *Checker) unpackRecv(rtyp ast.Expr, unpackParams bool) (ptr bool, rname *ast.Ident, tparams []*ast.Ident) {
resolver.go#L552: func (check *Checker) resolveBaseTypeName(seenPtr bool, name *ast.Ident) (ptr bool, base *TypeName) {
resolver.go#L615: func (check *Checker) packageObjects() {
resolver.go#L675: func (check *Checker) unusedImports() {
resolver.go#L692: func (check *Checker) errorUnusedPkg(obj *PkgName) {
return.go#L17: func (check *Checker) isTerminating(s ast.Stmt, label string) bool {
return.go#L79: func (check *Checker) isTerminatingList(list []ast.Stmt, label string) bool {
return.go#L89: func (check *Checker) isTerminatingSwitch(body *ast.BlockStmt, label string) bool {
signature.go#L102: func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast.FuncType) {
signature.go#L276: func (check *Checker) collectParams(scope *Scope, list *ast.FieldList, variadicOk bool) (params []*Var, variadic bool) {
stmt.go#L16: func (check *Checker) funcBody(decl *declInfo, name string, sig *Signature, body *ast.BlockStmt, iota constant.Value) {
stmt.go#L61: func (check *Checker) usage(scope *Scope) {
stmt.go#L101: func (check *Checker) simpleStmt(s ast.Stmt) {
stmt.go#L116: func (check *Checker) stmtList(ctxt stmtContext, list []ast.Stmt) {
stmt.go#L129: func (check *Checker) multipleDefaults(list []ast.Stmt) {
stmt.go#L155: func (check *Checker) openScope(node ast.Node, comment string) {
stmt.go#L161: func (check *Checker) closeScope() {
stmt.go#L173: func (check *Checker) suspendedCall(keyword string, call *ast.CallExpr) {
stmt.go#L237: func (check *Checker) caseValues(x *operand, values []ast.Expr, seen valueMap) {
stmt.go#L275: func (check *Checker) isNil(e ast.Expr) bool {
stmt.go#L285: func (check *Checker) caseTypes(x *operand, types []ast.Expr, seen map[Type]ast.Expr) (T Type) {
stmt.go#L363: func (check *Checker) stmt(ctxt stmtContext, s ast.Stmt) {
struct.go#L67: func (check *Checker) structType(styp *Struct, e *ast.StructType) {
struct.go#L198: func (check *Checker) declareInSet(oset *objset, pos token.Pos, obj Object) bool {
struct.go#L207: func (check *Checker) tag(t *ast.BasicLit) string {
subst.go#L52: func (check *Checker) subst(pos token.Pos, typ Type, smap substMap, ctxt *Context) Type {
subst.go#L78: check *Checker // nil if called via Instantiate
typeparam.go#L22: check *Checker // for lazy type bound completion
typeparam.go#L36: return (*Checker)(nil).newTypeParam(obj, constraint)
typeparam.go#L40: func (check *Checker) newTypeParam(obj *TypeName, constraint Type) *TypeParam {
typeset.go#L153: func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_TypeSet {
typeset.go#L393: func computeUnionTypeSet(check *Checker, unionSets map[*Union]*_TypeSet, pos token.Pos, utyp *Union) *_TypeSet {
typexpr.go#L22: func (check *Checker) ident(x *operand, e *ast.Ident, def *Named, wantType bool) {
typexpr.go#L138: func (check *Checker) typ(e ast.Expr) Type {
typexpr.go#L145: func (check *Checker) varType(e ast.Expr) Type {
typexpr.go#L153: func (check *Checker) validVarType(e ast.Expr, typ Type) {
typexpr.go#L181: func (check *Checker) definedType(e ast.Expr, def *Named) Type {
typexpr.go#L195: func (check *Checker) genericType(e ast.Expr, reason *string) Type {
typexpr.go#L218: func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) {
typexpr.go#L393: func (check *Checker) instantiatedType(ix *typeparams.IndexExpr, def *Named) (res Type) {
typexpr.go#L497: func (check *Checker) arrayLength(e ast.Expr) int64 {
typexpr.go#L541: func (check *Checker) typeList(list []ast.Expr) []Type {
union.go#L53: func parseUnion(check *Checker, uexpr ast.Expr) Type {
union.go#L138: func parseTilde(check *Checker, tx ast.Expr) *Term {
validtype.go#L12: func (check *Checker) validType(typ *Named) {
validtype.go#L23: func (check *Checker) validType0(typ Type, env *tparamEnv, path []Object) typeInfo {
version.go#L18: func (check *Checker) langCompat(lit *ast.BasicLit) {
version.go#L47: func (check *Checker) allowVersion(pkg *Package, major, minor int) bool {