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
}
GetIndexExprData extracts data from AST nodes that represent index
expressions.

For an ast.IndexExpr, the resulting IndexExprData will have exactly one
index expression. For an ast.IndexListExpr (go1.18+), it may have a
variable number of index expressions.

For nodes that don't represent index expressions, GetIndexExprData returns
nil.
TODO(rfindley): remove this function in favor of using the alias below.
package typeparams
import (
	"go/ast"
	"go/token"
	"go/types"
)