Documentation
¶
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 SetTypeParams(alias *Alias, tparams []*types.TypeParam)
- func TypeArgs(alias *Alias) *types.TypeList
- func TypeParams(alias *Alias) *types.TypeParamList
- func Unalias(t types.Type) types.Type
- type Alias
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶ added in v0.21.0
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 SetTypeParams ¶ added in v0.24.0
SetTypeParams sets the type parameters of the alias type.
func TypeArgs ¶ added in v0.24.0
TypeArgs returns the type arguments used to instantiate the Alias type.
func TypeParams ¶ added in v0.24.0
func TypeParams(alias *Alias) *types.TypeParamList
TypeParams returns the type parameter list of the alias.