You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the purposes of generic Alias types we propose the following additional API.
As with other generic types, instances are created with types.Instantiate.
These methods match the corresponding methods for Named types.
package types
// 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.// 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// 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
The text was updated successfully, but these errors were encountered:
These are the same methods that types.Named already has, so this seems fine.
rsc
changed the title
proposal: go/types: add Alias.{TypeParams, SetTypeParams, TypeArgs, Origin}
proposal: go/types: add Alias parameter methods
May 8, 2024
For the purposes of generic Alias types we propose the following additional API.
As with other generic types, instances are created with types.Instantiate.
These methods match the corresponding methods for Named types.
The text was updated successfully, but these errors were encountered: