type go/types.Checker
222 uses
go/types (current package)
alias.go#L58: alias := (*Checker)(nil).newAlias(obj, rhs)
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_predicates.go#L25: return (*Checker)(nil).newAssertableTo(V, T, nil)
api_predicates.go#L63: return (*Checker)(nil).implements(V, T, false, nil)
api_predicates.go#L71: return (*Checker)(nil).implements(V, T, true, nil)
assignments.go#L24: func (check *Checker) assignment(x *operand, T Type, context string) {
assignments.go#L121: func (check *Checker) initConst(lhs *Const, x *operand) {
assignments.go#L156: func (check *Checker) initVar(lhs *Var, x *operand, context string) {
assignments.go#L188: func (check *Checker) lhsVar(lhs ast.Expr) Type {
assignments.go#L252: func (check *Checker) assignVar(lhs, rhs ast.Expr, x *operand, context string) {
assignments.go#L304: func (check *Checker) typesSummary(list []Type, variadic, hasDots bool) string {
assignments.go#L354: func (check *Checker) assignError(rhs []ast.Expr, l, r int) {
assignments.go#L368: func (check *Checker) returnError(at positioner, lhs []*Var, rhs []*operand) {
assignments.go#L388: func (check *Checker) initVars(lhs []*Var, orig_rhs []ast.Expr, returnStmt ast.Stmt) {
assignments.go#L472: func (check *Checker) assignVars(lhs, orig_rhs []ast.Expr) {
assignments.go#L526: func (check *Checker) shortVarDecl(pos positioner, lhs, rhs []ast.Expr) {
badlinkname.go#L20: func badlinkname_Checker_infer(*Checker, positioner, []*TypeParam, []Type, *Tuple, []*operand, bool, *error_) []Type
builtins.go#L23: func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ bool) {
builtins.go#L965: func (check *Checker) applyTypeFunc(f func(Type) Type, x *operand, id builtinId) Type {
call.go#L35: func (check *Checker) funcInst(T *target, pos token.Pos, x *operand, ix *indexedExpr, infer bool) ([]Type, []ast.Expr) {
call.go#L133: func (check *Checker) instantiateSignature(pos token.Pos, expr ast.Expr, typ *Signature, targs []Type, xlist []ast.Expr) (res *Signature) {
call.go#L173: func (check *Checker) callExpr(x *operand, call *ast.CallExpr) exprKind {
call.go#L337: func (check *Checker) exprList(elist []ast.Expr) (xlist []*operand) {
call.go#L359: func (check *Checker) genericExprList(elist []ast.Expr) (resList []*operand, targsList [][]Type, xlistList [][]ast.Expr) {
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#L674: func (check *Checker) selector(x *operand, e *ast.SelectorExpr, def *TypeName, wantType bool) {
call.go#L983: func (check *Checker) use(args ...ast.Expr) bool { return check.useN(args, false) }
call.go#L988: func (check *Checker) useLHS(args ...ast.Expr) bool { return check.useN(args, true) }
call.go#L990: func (check *Checker) useN(args []ast.Expr, lhs bool) bool {
call.go#L1000: func (check *Checker) use1(e ast.Expr, lhs bool) bool {
check.go#L152: type Checker struct {
check.go#L205: func (check *Checker) addDeclDep(to Object) {
check.go#L222: func (check *Checker) brokenAlias(alias *TypeName) {
check.go#L232: func (check *Checker) validAlias(alias *TypeName, typ Type) {
check.go#L239: func (check *Checker) isBrokenAlias(alias *TypeName) bool {
check.go#L244: func (check *Checker) rememberUntyped(e ast.Expr, lhs bool, mode operandMode, typ *Basic, val constant.Value) {
check.go#L259: func (check *Checker) later(f func()) *action {
check.go#L266: func (check *Checker) push(obj Object) int {
check.go#L272: func (check *Checker) pop() Object {
check.go#L286: func (check *Checker) needsCleanup(c cleaner) {
check.go#L292: func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Checker {
check.go#L312: return &Checker{
check.go#L327: func (check *Checker) initFiles(files []*ast.File) {
check.go#L427: func (check *Checker) handleBailout(err *error) {
check.go#L439: func (check *Checker) Files(files []*ast.File) (err error) {
check.go#L460: func (check *Checker) checkFiles(files []*ast.File) {
check.go#L532: func (check *Checker) processDelayed(top int) {
check.go#L562: func (check *Checker) cleanup() {
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#L22: func (check *Checker) overflow(x *operand, opPos token.Pos) {
const.go#L66: func representableConst(x constant.Value, check *Checker, typ *Basic, rounded *constant.Value) bool {
const.go#L239: func (check *Checker) representable(x *operand, typ *Basic) {
const.go#L254: func (check *Checker) representation(x *operand, typ *Basic) (constant.Value, Code) {
const.go#L277: func (check *Checker) invalidConversion(code Code, x *operand, target Type) {
const.go#L289: func (check *Checker) convertUntyped(x *operand, target Type) {
conversions.go#L20: func (check *Checker) conversion(x *operand, T Type) {
conversions.go#L139: func (x *operand) convertibleTo(check *Checker, T Type, cause *string) bool {
decl.go#L17: func (check *Checker) declare(scope *Scope, id *ast.Ident, obj Object, pos token.Pos) {
decl.go#L51: func (check *Checker) objDecl(obj Object, def *TypeName) {
decl.go#L202: func (check *Checker) validCycle(obj Object) (valid bool) {
decl.go#L301: func (check *Checker) cycleError(cycle []Object, start int) {
decl.go#L382: func (check *Checker) walkDecls(decls []ast.Decl, f func(decl)) {
decl.go#L388: func (check *Checker) walkDecl(d ast.Decl, f func(decl)) {
decl.go#L432: func (check *Checker) constDecl(obj *Const, typ, init ast.Expr, inherited bool) {
decl.go#L478: func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init ast.Expr) {
decl.go#L532: func (check *Checker) isImportedConstraint(typ Type) bool {
decl.go#L541: func (check *Checker) typeDecl(obj *TypeName, tdecl *ast.TypeSpec, def *TypeName) {
decl.go#L656: func (check *Checker) collectTypeParams(dst **TypeParamList, list *ast.FieldList) {
decl.go#L711: func (check *Checker) bound(x ast.Expr) Type {
decl.go#L734: func (check *Checker) declareTypeParam(name *ast.Ident, scopePos token.Pos) *TypeParam {
decl.go#L747: func (check *Checker) collectMethods(obj *TypeName) {
decl.go#L804: func (check *Checker) checkFieldUniqueness(base *Named) {
decl.go#L834: func (check *Checker) funcDecl(obj *Func, decl *declInfo) {
decl.go#L873: func (check *Checker) declStmt(d ast.Decl) {
errors.go#L40: check *Checker
errors.go#L47: func (check *Checker) newError(code Code) *error_ {
errors.go#L156: func (check *Checker) handleError(index int, posn positioner, code Code, msg string, soft bool) {
errors.go#L234: func (check *Checker) error(at positioner, code Code, msg string) {
errors.go#L240: func (check *Checker) errorf(at positioner, code Code, format string, args ...any) {
errors.go#L246: func (check *Checker) softErrorf(at positioner, code Code, format string, args ...any) {
errors.go#L253: func (check *Checker) versionErrorf(at positioner, v goVersion, format string, args ...any) {
errsupport.go#L15: func (check *Checker) lookupError(typ Type, sel string, obj Object, structLit bool) string {
expr.go#L73: func (check *Checker) op(m opPredicates, x *operand, op token.Token) bool {
expr.go#L129: func (check *Checker) unary(x *operand, e *ast.UnaryExpr) {
expr.go#L230: func (check *Checker) updateExprType(x ast.Expr, typ Type, final bool) {
expr.go#L344: func (check *Checker) updateExprVal(x ast.Expr, val constant.Value) {
expr.go#L357: func (check *Checker) implicitTypeAndValue(x *operand, target Type) (Type, constant.Value, Code) {
expr.go#L452: func (check *Checker) comparison(x, y *operand, op token.Token, switchCase bool) {
expr.go#L577: func (check *Checker) incomparableCause(typ Type) string {
expr.go#L591: func (check *Checker) shift(x, y *operand, e ast.Expr, op token.Token) {
expr.go#L753: func (check *Checker) binary(x *operand, e ast.Expr, lhs, rhs ast.Expr, op token.Token, opPos token.Pos) {
expr.go#L849: func (check *Checker) matchTypes(x, y *operand) {
expr.go#L942: func (check *Checker) rawExpr(T *target, x *operand, e ast.Expr, hint Type, allowGeneric bool) exprKind {
expr.go#L966: func (check *Checker) nonGeneric(T *target, x *operand) {
expr.go#L995: func (check *Checker) exprInternal(T *target, x *operand, e ast.Expr, hint Type) exprKind {
expr.go#L1207: func (check *Checker) typeAssertion(e ast.Expr, x *operand, T Type, typeSwitch bool) {
expr.go#L1226: func (check *Checker) expr(T *target, x *operand, e ast.Expr) {
expr.go#L1233: func (check *Checker) genericExpr(x *operand, e ast.Expr) {
expr.go#L1244: func (check *Checker) multiExpr(e ast.Expr, allowCommaOk bool) (list []*operand, commaOk bool) {
expr.go#L1275: func (check *Checker) exprWithHint(x *operand, e ast.Expr, hint Type) {
expr.go#L1286: func (check *Checker) exprOrType(x *operand, e ast.Expr, allowGeneric bool) {
expr.go#L1294: func (check *Checker) exclude(x *operand, modeset uint) {
expr.go#L1321: func (check *Checker) singleValue(x *operand) {
format.go#L80: func (check *Checker) sprintf(format string, args ...any) string {
format.go#L90: func (check *Checker) trace(pos token.Pos, format string, args ...any) {
format.go#L99: func (check *Checker) dump(format string, args ...any) {
format.go#L103: func (check *Checker) qualifier(pkg *Package) string {
format.go#L122: func (check *Checker) markImports(pkg *Package) {
index.go#L19: func (check *Checker) indexExpr(x *operand, e *indexedExpr) (isFuncInst bool) {
index.go#L211: func (check *Checker) sliceExpr(x *operand, e *ast.SliceExpr) {
index.go#L333: func (check *Checker) singleIndex(expr *indexedExpr) ast.Expr {
index.go#L349: func (check *Checker) index(index ast.Expr, max int64) (typ Type, val int64) {
index.go#L378: func (check *Checker) isValidIndex(x *operand, code Code, what string, allowNegative bool) bool {
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#L471: func (check *Checker) renameTParams(pos token.Pos, tparams []*TypeParam, typ Type) ([]*TypeParam, Type) {
initorder.go#L20: func (check *Checker) initOrder() {
initorder.go#L168: func (check *Checker) reportCycle(cycle []Object) {
instantiate.go#L68: if i, err := (*Checker)(nil).verify(nopos, tparams, targs, ctxt); err != nil {
instantiate.go#L73: inst := (*Checker)(nil).instance(nopos, orig_, targs, nil, ctxt)
instantiate.go#L91: func (check *Checker) instance(pos token.Pos, orig genericType, targs []Type, expanding *Named, ctxt *Context) (res Type) {
instantiate.go#L191: func (check *Checker) validateTArgLen(pos token.Pos, name string, want, got int) bool {
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 {
interface.go#L18: 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#L159: func (check *Checker) interfaceType(ityp *Interface, iface *ast.InterfaceType, def *TypeName) {
labels.go#L15: func (check *Checker) labels(body *ast.BlockStmt) {
labels.go#L96: func (check *Checker) blockBranches(all *Scope, parent *block, lstmt *ast.LabeledStmt, list []ast.Stmt) []*ast.BranchStmt {
literals.go#L21: func (check *Checker) langCompat(lit *ast.BasicLit) {
literals.go#L48: func (check *Checker) basicLit(x *operand, e *ast.BasicLit) {
literals.go#L83: func (check *Checker) funcLit(x *operand, e *ast.FuncLit) {
literals.go#L111: func (check *Checker) compositeLit(x *operand, e *ast.CompositeLit, hint Type) {
literals.go#L353: func (check *Checker) indexedElts(elts []ast.Expr, typ Type, length int64) int64 {
lookup.go#L325: return (*Checker)(nil).missingMethod(V, T, static, Identical, nil)
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#L519: func (check *Checker) interfacePtrError(T Type) string {
lookup.go#L529: func (check *Checker) funcString(f *Func, pkgInfo bool) 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 {
mono.go#L86: func (check *Checker) monomorph() {
mono.go#L121: func (check *Checker) reportInstanceLoop(v int) {
named.go#L110: check *Checker // non-nil during type-checking; nil otherwise
named.go#L162: return (*Checker)(nil).newNamed(obj, underlying, methods)
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#L623: func (check *Checker) context() *Context {
operand.go#L312: func (x *operand) assignableTo(check *Checker, T Type, cause *string) (bool, Code) {
predicates.go#L366: var check *Checker // ok to call subst on a nil *Checker
recording.go#L18: func (check *Checker) record(x *operand) {
recording.go#L45: func (check *Checker) recordUntyped() {
recording.go#L59: func (check *Checker) recordTypeAndValue(x ast.Expr, mode operandMode, typ Type, val constant.Value) {
recording.go#L77: func (check *Checker) recordBuiltinType(f ast.Expr, sig *Signature) {
recording.go#L97: func (check *Checker) recordCommaOkTypes(x ast.Expr, a []*operand) {
recording.go#L132: func (check *Checker) recordInstance(expr ast.Expr, targs []Type, typ Type) {
recording.go#L141: func (check *Checker) recordDef(id *ast.Ident, obj Object) {
recording.go#L148: func (check *Checker) recordUse(id *ast.Ident, obj Object) {
recording.go#L156: func (check *Checker) recordImplicit(node ast.Node, obj Object) {
recording.go#L164: func (check *Checker) recordSelection(x *ast.SelectorExpr, kind SelectionKind, recv Type, obj Object, index []int, indirect bool) {
recording.go#L172: func (check *Checker) recordScope(node ast.Node, scope *Scope) {
resolver.go#L55: func (check *Checker) arityMatch(s, init *ast.ValueSpec) {
resolver.go#L105: func (check *Checker) declarePkgObj(ident *ast.Ident, obj Object, d *declInfo) {
resolver.go#L128: func (check *Checker) filename(fileNo int) string {
resolver.go#L136: func (check *Checker) importPackage(at positioner, path, dir string) *Package {
resolver.go#L216: func (check *Checker) collectObjects() {
resolver.go#L513: func (check *Checker) unpackRecv(rtyp ast.Expr, unpackParams bool) (ptr bool, base ast.Expr, tparams []*ast.Ident) {
resolver.go#L555: func (check *Checker) resolveBaseTypeName(ptr bool, name *ast.Ident) (ptr_ bool, base *TypeName) {
resolver.go#L625: func (check *Checker) packageObjects() {
resolver.go#L702: func (check *Checker) unusedImports() {
resolver.go#L719: 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#L108: func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast.FuncType) {
signature.go#L162: func (check *Checker) collectRecv(rparam *ast.Field, scopePos token.Pos) (*Var, *TypeParamList) {
signature.go#L330: func (check *Checker) recordParenthesizedRecvTypes(expr ast.Expr, typ Type) {
signature.go#L354: func (check *Checker) collectParams(list *ast.FieldList, variadicOk bool) (names []*ast.Ident, params []*Var, variadic bool) {
signature.go#L415: func (check *Checker) declareParams(names []*ast.Ident, params []*Var, scopePos token.Pos) {
signature.go#L425: func (check *Checker) validRecv(pos positioner, recv *Var) {
stmt.go#L19: func (check *Checker) funcBody(decl *declInfo, name string, sig *Signature, body *ast.BlockStmt, iota constant.Value) {
stmt.go#L58: func (check *Checker) usage(scope *Scope) {
stmt.go#L99: func (check *Checker) simpleStmt(s ast.Stmt) {
stmt.go#L114: func (check *Checker) stmtList(ctxt stmtContext, list []ast.Stmt) {
stmt.go#L127: func (check *Checker) multipleDefaults(list []ast.Stmt) {
stmt.go#L153: func (check *Checker) openScope(node ast.Node, comment string) {
stmt.go#L159: func (check *Checker) closeScope() {
stmt.go#L171: func (check *Checker) suspendedCall(keyword string, call *ast.CallExpr) {
stmt.go#L235: func (check *Checker) caseValues(x *operand, values []ast.Expr, seen valueMap) {
stmt.go#L275: func (check *Checker) isNil(e ast.Expr) bool {
stmt.go#L305: func (check *Checker) caseTypes(x *operand, types []ast.Expr, seen map[Type]ast.Expr) 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#L409: func (check *Checker) stmt(ctxt stmtContext, s ast.Stmt) {
stmt.go#L875: func (check *Checker) rangeStmt(inner stmtContext, s *ast.RangeStmt) {
struct.go#L68: func (check *Checker) structType(styp *Struct, e *ast.StructType) {
struct.go#L200: func (check *Checker) declareInSet(oset *objset, pos token.Pos, obj Object) bool {
struct.go#L211: func (check *Checker) tag(t *ast.BasicLit) string {
subst.go#L58: func (check *Checker) subst(pos token.Pos, typ Type, smap substMap, expanding *Named, ctxt *Context) Type {
subst.go#L87: check *Checker // nil if called via Instantiate
typeparam.go#L26: check *Checker // for lazy type bound completion
typeparam.go#L40: return (*Checker)(nil).newTypeParam(obj, constraint)
typeparam.go#L44: func (check *Checker) newTypeParam(obj *TypeName, constraint Type) *TypeParam {
typeset.go#L155: func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_TypeSet {
typeset.go#L375: func computeUnionTypeSet(check *Checker, unionSets map[*Union]*_TypeSet, pos token.Pos, utyp *Union) *_TypeSet {
typexpr.go#L21: func (check *Checker) ident(x *operand, e *ast.Ident, def *TypeName, wantType 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#L232: func (check *Checker) typInternal(e0 ast.Expr, def *TypeName) (T Type) {
typexpr.go#L433: func (check *Checker) instantiatedType(ix *indexedExpr, def *TypeName) (res Type) {
typexpr.go#L508: func (check *Checker) arrayLength(e ast.Expr) int64 {
typexpr.go#L556: func (check *Checker) typeList(list []ast.Expr) []Type {
union.go#L54: func parseUnion(check *Checker, uexpr ast.Expr) Type {
union.go#L139: func parseTilde(check *Checker, tx ast.Expr) *Term {
validtype.go#L16: func (check *Checker) validType(typ *Named) {
validtype.go#L30: func (check *Checker) validType0(pos token.Pos, typ Type, nest, path []*Named) bool {
version.go#L54: func (check *Checker) allowVersion(want goVersion) bool {
version.go#L60: func (check *Checker) verifyVersionf(at positioner, v goVersion, format string, args ...interface{}) bool {