func SetForNamed(n *types.Named, tparams []*TypeParam) {
	n.SetTypeParams(tparams)
}
SetForNamed sets the type params tparams on n. Each tparam must be of
dynamic type *types.TypeParam.
package typeparams
import (
	"go/ast"
	"go/token"
	"go/types"
)
func GetIndexExprData(n ast.Node) *IndexExprData {
	switch e := n.(type) {
	case *ast.IndexExpr:
		return &IndexExprData{
			X:       e.X,
			Lbrack:  e.Lbrack,
			Indices: []ast.Expr{e.Index},
			Rbrack:  e.Rbrack,
		}
	case *ast.IndexListExpr:
		return (*IndexExprData)(e)
	}
	return nil
}
func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr {
	switch len(indices) {
	case 0:
		panic("empty indices")
	case 1:
		return &ast.IndexExpr{
			X:      x,
			Lbrack: lbrack,
			Index:  indices[0],
			Rbrack: rbrack,
		}
	default:
		return &ast.IndexListExpr{
			X:       x,
			Lbrack:  lbrack,
			Indices: indices,
			Rbrack:  rbrack,
		}
	}
}
type IndexListExpr = ast.IndexListExpr
func ForTypeSpec(n *ast.TypeSpec) *ast.FieldList {
	if n == nil {
		return nil
	}
	return n.TypeParams
}
func ForFuncType(n *ast.FuncType) *ast.FieldList {
	if n == nil {
		return nil
	}
	return n.TypeParams
}
type TypeParam = types.TypeParam
type TypeParamList = types.TypeParamList
type TypeList = types.TypeList
func NewTypeParam(name *types.TypeName, constraint types.Type) *TypeParam {
	return types.NewTypeParam(name, constraint)
}
func SetTypeParamConstraint(tparam *TypeParam, constraint types.Type) {
	tparam.SetConstraint(constraint)
}
func NewSignatureType(recv *types.Var, recvTypeParams, typeParams []*TypeParam, params, results *types.Tuple, variadic bool) *types.Signature {
	return types.NewSignatureType(recv, recvTypeParams, typeParams, params, results, variadic)
}
func ForSignature(sig *types.Signature) *TypeParamList {
	return sig.TypeParams()
}
func RecvTypeParams(sig *types.Signature) *TypeParamList {
	return sig.RecvTypeParams()
}
func IsComparable(iface *types.Interface) bool {
	return iface.IsComparable()
}
func IsMethodSet(iface *types.Interface) bool {
	return iface.IsMethodSet()
}
func IsImplicit(iface *types.Interface) bool {
	return iface.IsImplicit()
}
func MarkImplicit(iface *types.Interface) {
	iface.MarkImplicit()
}
func ForNamed(named *types.Named) *TypeParamList {
	return named.TypeParams()
}