typesutil

package
v0.18.0-pre.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnclosingSignature added in v0.17.0

func EnclosingSignature(path []ast.Node, info *types.Info) *types.Signature

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 FormatTypeParams added in v0.17.0

func FormatTypeParams(tparams *types.TypeParamList) string

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 TypesFromContext added in v0.17.0

func TypesFromContext(info *types.Info, path []ast.Node, pos token.Pos) []types.Type

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL