package aliases
import "golang.org/x/tools/internal/aliases"
Index ¶
- func Enabled() bool
- func NewAlias(enabled bool, pos token.Pos, pkg *types.Package, name string, rhs types.Type) *types.TypeName
- func Rhs(alias *Alias) types.Type
- func Unalias(t types.Type) types.Type
- type Alias
Functions ¶
func Enabled ¶
func Enabled() bool
Enabled reports whether NewAlias should create types.Alias types.
This function is expensive! Call it sparingly.
func NewAlias ¶
func NewAlias(enabled bool, pos token.Pos, pkg *types.Package, name string, rhs types.Type) *types.TypeName
NewAlias creates a new TypeName in Package pkg that is an alias for the type rhs.
The enabled parameter determines whether the resulting [TypeName]'s type is an types.Alias. Its value must be the result of a call to Enabled, which computes the effective value of GODEBUG=gotypesalias=... by invoking the type checker. The Enabled function is expensive and should be called once per task (e.g. package import), not once per call to NewAlias.
func Rhs ¶
Rhs returns the type on the right-hand side of the alias declaration.
func Unalias ¶
Unalias is a wrapper of types.Unalias.
Types ¶
type Alias ¶
Alias is an alias of types.Alias.
Source Files ¶
aliases.go aliases_go122.go
- Version
- v0.23.0
- Published
- Jul 7, 2024
- Platform
- windows/amd64
- Imports
- 4 packages
- Last checked
- 1 minute ago –
Tools for package owners.