type Alias … // NewAlias creates a new Alias type with the given type name and rhs. // rhs must not be nil. func NewAlias(obj *TypeName, rhs Type) *Alias { … } // Obj returns the type name for the declaration defining the alias type a. // For instantiated types, this is same as the type name of the origin type. func (a *Alias) Obj() *TypeName { … } func (a *Alias) String() string { … } // Underlying returns the [underlying type] of the alias type a, which is the // underlying type of the aliased type. Underlying types are never Named, // TypeParam, or Alias types. // // [underlying type]: https://go.dev/ref/spec#Underlying_types. func (a *Alias) Underlying() Type { … } // Origin returns the generic Alias type of which a is an instance. // If a is not an instance of a generic alias, Origin returns a. func (a *Alias) Origin() *Alias { … } // TypeParams returns the type parameters of the alias type a, or nil. // A generic Alias and its instances have the same type parameters. func (a *Alias) TypeParams() *TypeParamList { … } // SetTypeParams sets the type parameters of the alias type a. // The alias a must not have type arguments. func (a *Alias) SetTypeParams(tparams []*TypeParam) { … } // TypeArgs returns the type arguments used to instantiate the Alias type. // If a is not an instance of a generic alias, the result is nil. func (a *Alias) TypeArgs() *TypeList { … } // Rhs returns the type R on the right-hand side of an alias // declaration "type A = R", which may be another alias. func (a *Alias) Rhs() Type { … } // Unalias returns t if it is not an alias type; // otherwise it follows t's alias chain until it // reaches a non-alias type which is then returned. // Consequently, the result is never an alias type. func Unalias(t Type) Type { … } func unalias(a0 *Alias) Type { … } // asNamed returns t as *Named if that is t's // actual type. It returns nil otherwise. func asNamed(t Type) *Named { … } // newAlias creates a new Alias type with the given type name and rhs. // rhs must not be nil. func (check *Checker) newAlias(obj *TypeName, rhs Type) *Alias { … } // newAliasInstance creates a new alias instance for the given origin and type // arguments, recording pos as the position of its synthetic object (for error // reporting). func (check *Checker) newAliasInstance(pos syntax.Pos, orig *Alias, targs []Type, expanding *Named, ctxt *Context) *Alias { … } func (a *Alias) cleanup() { … }