type go/types.Checker
227 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#L1038: func (check *Checker) applyTypeFunc(f func(Type) Type, x *operand, id builtinId) Type {
call.go#L34: func (check *Checker) funcInst(T *target, pos token.Pos, x *operand, ix *indexedExpr, infer bool) []Type {
call.go#L132: func (check *Checker) instantiateSignature(pos token.Pos, expr ast.Expr, typ *Signature, targs []Type, xlist []ast.Expr) (res *Signature) {
call.go#L172: func (check *Checker) callExpr(x *operand, call *ast.CallExpr) exprKind {
call.go#L343: func (check *Checker) exprList(elist []ast.Expr) (xlist []*operand) {
call.go#L365: func (check *Checker) genericExprList(elist []ast.Expr) (resList []*operand, targsList [][]Type) {
call.go#L462: func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type, xlist []ast.Expr, args []*operand, atargs [][]Type) (rsig *Signature) {
call.go#L674: func (check *Checker) selector(x *operand, e *ast.SelectorExpr, def *TypeName, wantType bool) {
call.go#L990: func (check *Checker) use(args ...ast.Expr) bool { return check.useN(args, false) }
call.go#L995: func (check *Checker) useLHS(args ...ast.Expr) bool { return check.useN(args, true) }
call.go#L997: func (check *Checker) useN(args []ast.Expr, lhs bool) bool {
call.go#L1007: func (check *Checker) use1(e ast.Expr, lhs bool) bool {
check.go#L156: type Checker struct {
check.go#L210: func (check *Checker) addDeclDep(to Object) {
check.go#L227: func (check *Checker) brokenAlias(alias *TypeName) {
check.go#L237: func (check *Checker) validAlias(alias *TypeName, typ Type) {
check.go#L244: func (check *Checker) isBrokenAlias(alias *TypeName) bool {
check.go#L249: func (check *Checker) rememberUntyped(e ast.Expr, lhs bool, mode operandMode, typ *Basic, val constant.Value) {
check.go#L264: func (check *Checker) later(f func()) *action {
check.go#L271: func (check *Checker) push(obj Object) int {
check.go#L277: func (check *Checker) pop() Object {
check.go#L291: func (check *Checker) needsCleanup(c cleaner) {
check.go#L297: func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Checker {
check.go#L317: return &Checker{
check.go#L332: func (check *Checker) initFiles(files []*ast.File) {
check.go#L430: func (check *Checker) pushPos(pos positioner) {
check.go#L435: func (check *Checker) popPos() {
check.go#L442: func (check *Checker) handleBailout(err *error) {
check.go#L472: func (check *Checker) Files(files []*ast.File) (err error) {
check.go#L493: func (check *Checker) checkFiles(files []*ast.File) {
check.go#L565: func (check *Checker) processDelayed(top int) {
check.go#L595: func (check *Checker) cleanup() {
check.go#L605: func (check *Checker) recordTypeAndValueInSyntax(x ast.Expr, mode operandMode, typ Type, val constant.Value) {
check.go#L611: 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#L213: func (check *Checker) validCycle(obj Object) (valid bool) {
decl.go#L312: func (check *Checker) cycleError(cycle []Object, start int) {
decl.go#L393: func (check *Checker) walkDecls(decls []ast.Decl, f func(decl)) {
decl.go#L399: func (check *Checker) walkDecl(d ast.Decl, f func(decl)) {
decl.go#L443: func (check *Checker) constDecl(obj *Const, typ, init ast.Expr, inherited bool) {
decl.go#L489: func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init ast.Expr) {
decl.go#L543: func (check *Checker) isImportedConstraint(typ Type) bool {
decl.go#L552: func (check *Checker) typeDecl(obj *TypeName, tdecl *ast.TypeSpec, def *TypeName) {
decl.go#L667: func (check *Checker) collectTypeParams(dst **TypeParamList, list *ast.FieldList) {
decl.go#L722: func (check *Checker) bound(x ast.Expr) Type {
decl.go#L745: func (check *Checker) declareTypeParam(name *ast.Ident, scopePos token.Pos) *TypeParam {
decl.go#L758: func (check *Checker) collectMethods(obj *TypeName) {
decl.go#L815: func (check *Checker) checkFieldUniqueness(base *Named) {
decl.go#L845: func (check *Checker) funcDecl(obj *Func, decl *declInfo) {
decl.go#L884: 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#L197: func (check *Checker) chanElem(pos positioner, x *operand, recv bool) Type {
expr.go#L260: func (check *Checker) updateExprType(x ast.Expr, typ Type, final bool) {
expr.go#L374: func (check *Checker) updateExprVal(x ast.Expr, val constant.Value) {
expr.go#L387: func (check *Checker) implicitTypeAndValue(x *operand, target Type) (Type, constant.Value, Code) {
expr.go#L482: func (check *Checker) comparison(x, y *operand, op token.Token, switchCase bool) {
expr.go#L607: func (check *Checker) incomparableCause(typ Type) string {
expr.go#L617: func (check *Checker) shift(x, y *operand, e ast.Expr, op token.Token) {
expr.go#L779: func (check *Checker) binary(x *operand, e ast.Expr, lhs, rhs ast.Expr, op token.Token, opPos token.Pos) {
expr.go#L875: func (check *Checker) matchTypes(x, y *operand) {
expr.go#L968: func (check *Checker) rawExpr(T *target, x *operand, e ast.Expr, hint Type, allowGeneric bool) exprKind {
expr.go#L992: func (check *Checker) nonGeneric(T *target, x *operand) {
expr.go#L1021: func (check *Checker) exprInternal(T *target, x *operand, e ast.Expr, hint Type) exprKind {
expr.go#L1232: func (check *Checker) typeAssertion(e ast.Expr, x *operand, T Type, typeSwitch bool) {
expr.go#L1251: func (check *Checker) expr(T *target, x *operand, e ast.Expr) {
expr.go#L1258: func (check *Checker) genericExpr(x *operand, e ast.Expr) {
expr.go#L1269: func (check *Checker) multiExpr(e ast.Expr, allowCommaOk bool) (list []*operand, commaOk bool) {
expr.go#L1300: func (check *Checker) exprWithHint(x *operand, e ast.Expr, hint Type) {
expr.go#L1311: func (check *Checker) exprOrType(x *operand, e ast.Expr, allowGeneric bool) {
expr.go#L1319: func (check *Checker) exclude(x *operand, modeset uint) {
expr.go#L1346: 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#L120: func (check *Checker) dump(format string, args ...any) {
format.go#L124: func (check *Checker) qualifier(pkg *Package) string {
format.go#L143: 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#L373: func (check *Checker) singleIndex(expr *indexedExpr) ast.Expr {
index.go#L389: func (check *Checker) index(index ast.Expr, max int64) (typ Type, val int64) {
index.go#L418: 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#L354: func (check *Checker) indexedElts(elts []ast.Expr, typ Type, length int64) int64 {
lookup.go#L366: return (*Checker)(nil).missingMethod(V, T, static, Identical, nil)
lookup.go#L378: func (check *Checker) missingMethod(V, T Type, static bool, equivalent func(x, y Type) bool, cause *string) (method *Func, wrongType bool) {
lookup.go#L529: func (check *Checker) hasAllMethods(V, T Type, static bool, equivalent func(x, y Type) bool, cause *string) bool {
lookup.go#L560: func (check *Checker) interfacePtrError(T Type) string {
lookup.go#L570: func (check *Checker) funcString(f *Func, pkgInfo bool) string {
lookup.go#L589: func (check *Checker) assertableTo(V, T Type, cause *string) bool {
lookup.go#L605: 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#L364: var check *Checker // ok to call subst on a nil *Checker
range.go#L27: func (check *Checker) rangeStmt(inner stmtContext, rangeStmt *ast.RangeStmt, noNewVarPos positioner, sKey, sValue, sExtra, rangeVar ast.Expr, isDef bool) {
range.go#L206: func rangeKeyVal(check *Checker, orig Type, allowVersion func(goVersion) bool) (key, val Type, cause string, ok bool) {
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#L511: func (check *Checker) unpackRecv(rtyp ast.Expr, unpackParams bool) (ptr bool, base ast.Expr, tparams []*ast.Ident) {
resolver.go#L553: func (check *Checker) resolveBaseTypeName(ptr bool, name *ast.Ident) (ptr_ bool, base *TypeName) {
resolver.go#L623: func (check *Checker) packageObjects() {
resolver.go#L700: func (check *Checker) unusedImports() {
resolver.go#L717: 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#L130: func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast.FuncType) {
signature.go#L184: func (check *Checker) collectRecv(rparam *ast.Field, scopePos token.Pos) (*Var, *TypeParamList) {
signature.go#L352: func (check *Checker) recordParenthesizedRecvTypes(expr ast.Expr, typ Type) {
signature.go#L377: func (check *Checker) collectParams(kind VarKind, list *ast.FieldList) (names []*ast.Ident, params []*Var, variadic bool) {
signature.go#L438: func (check *Checker) declareParams(names []*ast.Ident, params []*Var, scopePos token.Pos) {
signature.go#L448: func (check *Checker) validRecv(pos positioner, recv *Var) {
stmt.go#L18: func (check *Checker) funcBody(decl *declInfo, name string, sig *Signature, body *ast.BlockStmt, iota constant.Value) {
stmt.go#L57: 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#L277: func (check *Checker) isNil(e ast.Expr) bool {
stmt.go#L307: func (check *Checker) caseTypes(x *operand, types []ast.Expr, seen map[Type]ast.Expr) Type {
stmt.go#L359: func (check *Checker) caseTypes_currently_unused(x *operand, xtyp *Interface, types []ast.Expr, seen map[string]ast.Expr) Type {
stmt.go#L411: func (check *Checker) stmt(ctxt stmtContext, s ast.Stmt) {
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#L431: func (check *Checker) instantiatedType(ix *indexedExpr, def *TypeName) (res Type) {
typexpr.go#L506: func (check *Checker) arrayLength(e ast.Expr) int64 {
typexpr.go#L554: func (check *Checker) typeList(list []ast.Expr) []Type {
under.go#L63: func (err *typeError) format(check *Checker) string {
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 {