go/ast/astutil: restore compatibility with Go 1.17
@@ -6,6 +6,8 @@ import (
"go/token"
"reflect"
"strings"
+
+ "golang.org/x/exp/typeparams"
)
func IsIdent(expr ast.Expr, ident string) bool {
@@ -130,7 +132,7 @@ func CopyExpr(node ast.Expr) (ast.Expr, bool) {
cp.X, ok1 = CopyExpr(cp.X)
cp.Index, ok2 = CopyExpr(cp.Index)
return &cp, ok1 && ok2
- case *ast.IndexListExpr:
+ case *typeparams.IndexListExpr:
var ok bool
cp := *node
cp.X, ok = CopyExpr(cp.X)
@@ -278,8 +280,8 @@ func Equal(a, b ast.Node) bool {
case *ast.IndexExpr:
b := b.(*ast.IndexExpr)
return Equal(a.X, b.X) && Equal(a.Index, b.Index)
- case *ast.IndexListExpr:
- b := b.(*ast.IndexListExpr)
+ case *typeparams.IndexListExpr:
+ b := b.(*typeparams.IndexListExpr)
if len(a.Indices) != len(b.Indices) {
return false
}
