Skip to content

Commit

Permalink
go/ast/astutil: restore compatibility with Go 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikh committed Mar 30, 2022
1 parent a34f635 commit 5fe689a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions go/ast/astutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"go/token"
"reflect"
"strings"

"golang.org/x/exp/typeparams"
)

func IsIdent(expr ast.Expr, ident string) bool {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 5fe689a

Please sign in to comment.