Skip to content

Commit 5fe689a

Browse files
committed
go/ast/astutil: restore compatibility with Go 1.17
1 parent a34f635 commit 5fe689a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

go/ast/astutil/util.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"go/token"
77
"reflect"
88
"strings"
9+
10+
"golang.org/x/exp/typeparams"
911
)
1012

1113
func IsIdent(expr ast.Expr, ident string) bool {
@@ -130,7 +132,7 @@ func CopyExpr(node ast.Expr) (ast.Expr, bool) {
130132
cp.X, ok1 = CopyExpr(cp.X)
131133
cp.Index, ok2 = CopyExpr(cp.Index)
132134
return &cp, ok1 && ok2
133-
case *ast.IndexListExpr:
135+
case *typeparams.IndexListExpr:
134136
var ok bool
135137
cp := *node
136138
cp.X, ok = CopyExpr(cp.X)
@@ -278,8 +280,8 @@ func Equal(a, b ast.Node) bool {
278280
case *ast.IndexExpr:
279281
b := b.(*ast.IndexExpr)
280282
return Equal(a.X, b.X) && Equal(a.Index, b.Index)
281-
case *ast.IndexListExpr:
282-
b := b.(*ast.IndexListExpr)
283+
case *typeparams.IndexListExpr:
284+
b := b.(*typeparams.IndexListExpr)
283285
if len(a.Indices) != len(b.Indices) {
284286
return false
285287
}

0 commit comments

Comments
 (0)