aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/predicates.go
diff options
context:
space:
mode:
authorRobert Findley <rfindley@google.com>2022-01-24 15:42:52 -0500
committerRobert Findley <rfindley@google.com>2022-01-24 22:28:27 +0000
commit84eefdc933410907495e42aac872036403851ffa (patch)
treea602b6767e48f59421d69e8018f6461c1b280825 /src/cmd/compile/internal/types2/predicates.go
parent671e1150c680eb5f21833662362954cc1b155d2b (diff)
downloadgo-84eefdc933410907495e42aac872036403851ffa.tar.gz
go-84eefdc933410907495e42aac872036403851ffa.zip
go/types, types2: pass the seen map through _TypeSet.IsComparable
While checking comparability of type parameters, we recurse through _TypeSet.IsComparable, but do not pass the cycle-tracking seen map, resulting in infinite recursion in some cases. Refactor to pass the seen map through this recursion. Fixes #50782 Change-Id: I2c2bcfed3398c11eb9aa0c871da59e348bfba5f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/380504 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/types2/predicates.go')
-rw-r--r--src/cmd/compile/internal/types2/predicates.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types2/predicates.go b/src/cmd/compile/internal/types2/predicates.go
index d982866f8e..cc3c76e695 100644
--- a/src/cmd/compile/internal/types2/predicates.go
+++ b/src/cmd/compile/internal/types2/predicates.go
@@ -131,7 +131,7 @@ func comparable(T Type, seen map[Type]bool) bool {
case *Array:
return comparable(t.elem, seen)
case *Interface:
- return !isTypeParam(T) || t.IsComparable()
+ return !isTypeParam(T) || t.typeSet().IsComparable(seen)
}
return false
}