aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-toolsmith/astequal
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2022-09-05 14:27:54 +0200
committerGitHub <noreply@github.com>2022-09-05 12:27:54 +0000
commitb2f2446b46bf02821d90ebedadae2bf7ae0e880e (patch)
tree923cf42842918d6bebca1d6bbdc08abed54d274d /vendor/github.com/go-toolsmith/astequal
parente6654faff4bcca4be92e9a8596fd4b77f747c39e (diff)
go.mod, vendor: update (#3358)
* go.mod, vendor: remove unnecessary dependencies Commands: 1. go mod tidy 2. go mod vendor * go.mod, vendor: update cloud.google.com/go Commands: 1. go get -u cloud.google.com/go 2. go mod tidy 3. go mod vendor * go.mod, vendor: update cloud.google.com/* Commands: 1. go get -u cloud.google.com/storage cloud.google.com/logging 2. go mod tidy 3. go mod vendor * go.mod, .golangci.yml, vendor: update *lint* Commands: 1. go get -u golang.org/x/tools github.com/golangci/golangci-lint@v1.47.0 2. go mod tidy 3. go mod vendor 4. edit .golangci.yml to suppress new errors (resolved in the same PR later) * all: fix lint errors hash.go: copy() recommended by gosimple parse.go: ent is never nil verifier.go: signal.Notify() with unbuffered channel is bad. Have no idea why. * .golangci.yml: adjust godot rules check-all is deprecated, but still work if you're hesitating too - I'll remove this commit
Diffstat (limited to 'vendor/github.com/go-toolsmith/astequal')
-rw-r--r--vendor/github.com/go-toolsmith/astequal/astequal.go16
-rw-r--r--vendor/github.com/go-toolsmith/astequal/go.mod6
-rw-r--r--vendor/github.com/go-toolsmith/astequal/go.sum4
3 files changed, 24 insertions, 2 deletions
diff --git a/vendor/github.com/go-toolsmith/astequal/astequal.go b/vendor/github.com/go-toolsmith/astequal/astequal.go
index 6a32d7218..b2ab0e640 100644
--- a/vendor/github.com/go-toolsmith/astequal/astequal.go
+++ b/vendor/github.com/go-toolsmith/astequal/astequal.go
@@ -4,6 +4,8 @@ package astequal
import (
"go/ast"
"go/token"
+
+ "golang.org/x/exp/typeparams"
)
// Node reports whether two AST nodes are structurally (deep) equal.
@@ -60,6 +62,14 @@ func astNodeEq(x, y ast.Node) bool {
case ast.Decl:
y, ok := y.(ast.Decl)
return ok && astDeclEq(x, y)
+
+ case *ast.Field:
+ y, ok := y.(*ast.Field)
+ return ok && astFieldEq(x, y)
+ case *ast.FieldList:
+ y, ok := y.(*ast.FieldList)
+ return ok && astFieldListEq(x, y)
+
default:
return false
}
@@ -308,7 +318,8 @@ func astFuncTypeEq(x, y *ast.FuncType) bool {
return x == y
}
return astFieldListEq(x.Params, y.Params) &&
- astFieldListEq(x.Results, y.Results)
+ astFieldListEq(x.Results, y.Results) &&
+ astFieldListEq(typeparams.ForFuncType(x), typeparams.ForFuncType(y))
}
func astBasicLitEq(x, y *ast.BasicLit) bool {
@@ -667,7 +678,8 @@ func astTypeSpecEq(x, y *ast.TypeSpec) bool {
if x == nil || y == nil {
return x == y
}
- return astIdentEq(x.Name, y.Name) && astExprEq(x.Type, y.Type)
+ return astIdentEq(x.Name, y.Name) && astExprEq(x.Type, y.Type) &&
+ astFieldListEq(typeparams.ForTypeSpec(x), typeparams.ForTypeSpec(y))
}
func astValueSpecEq(x, y *ast.ValueSpec) bool {
diff --git a/vendor/github.com/go-toolsmith/astequal/go.mod b/vendor/github.com/go-toolsmith/astequal/go.mod
index 86fa40772..f5a12599c 100644
--- a/vendor/github.com/go-toolsmith/astequal/go.mod
+++ b/vendor/github.com/go-toolsmith/astequal/go.mod
@@ -1 +1,7 @@
module github.com/go-toolsmith/astequal
+
+go 1.16
+
+require github.com/go-toolsmith/strparse v1.0.0
+
+require golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171 // indirect
diff --git a/vendor/github.com/go-toolsmith/astequal/go.sum b/vendor/github.com/go-toolsmith/astequal/go.sum
new file mode 100644
index 000000000..74e570ff4
--- /dev/null
+++ b/vendor/github.com/go-toolsmith/astequal/go.sum
@@ -0,0 +1,4 @@
+github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4=
+github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8=
+golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171 h1:DZhP7zSquENyG3Yb6ZpGqNEtgE8dfXhcLcheIF9RQHY=
+golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=