// FileQualifier returns a [types.Qualifier] function that qualifies // imported symbols appropriately based on the import environment of a // given file. func FileQualifier(f *ast.File, pkg *types.Package, info *types.Info) types.Qualifier { … } // FormatTypeParams turns TypeParamList into its Go representation, such as: // [T, Y]. Note that it does not print constraints as this is mainly used for // formatting type params in method receivers. func FormatTypeParams(tparams *types.TypeParamList) string { … } // TypesFromContext returns the type (or perhaps zero or multiple types) // of the "hole" into which the expression identified by path must fit. // // For example, given // // s, i := "", 0 // s, i = EXPR // // the hole that must be filled by EXPR has type (string, int). // // It returns nil on failure. func TypesFromContext(info *types.Info, path []ast.Node, pos token.Pos) []types.Type { … } // parentNode returns the nodes immediately enclosing path[0], // ignoring parens. func parentNode(path []ast.Node) ast.Node { … } // containsInvalid checks if the type name contains "invalid type", // which is not a valid syntax to generate. func containsInvalid(t types.Type) bool { … } // EnclosingSignature returns the signature of the innermost // function enclosing the syntax node denoted by path // (see [astutil.PathEnclosingInterval]), or nil if the node // is not within a function. func EnclosingSignature(path []ast.Node, info *types.Info) *types.Signature { … }