diff options
author | Robert Griesemer <gri@golang.org> | 2021-11-12 08:59:49 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-11-13 00:26:24 +0000 |
commit | 787708a6ff66092678cd4312358e90a5085eac89 (patch) | |
tree | 8ef7a2f8d827170599bec327d6960396616f7160 /src/cmd/compile/internal/types2/predicates.go | |
parent | bc0b98eeffa64f155e7f2a2dc6b883a97c4d0580 (diff) | |
download | go-787708a6ff66092678cd4312358e90a5085eac89.tar.gz go-787708a6ff66092678cd4312358e90a5085eac89.zip |
cmd/compile/internal/types2: remove tparamIsIface flag and corresponding dead code
Added/clarified some comments.
Change-Id: Ib08d3343ff08c23cc8880a27a0148d1ff077a80f
Reviewed-on: https://go-review.googlesource.com/c/go/+/363654
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/predicates.go')
-rw-r--r-- | src/cmd/compile/internal/types2/predicates.go | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/cmd/compile/internal/types2/predicates.go b/src/cmd/compile/internal/types2/predicates.go index 62db3861ed..8ba534ce77 100644 --- a/src/cmd/compile/internal/types2/predicates.go +++ b/src/cmd/compile/internal/types2/predicates.go @@ -131,13 +131,7 @@ func comparable(T Type, seen map[Type]bool) bool { case *Array: return comparable(t.elem, seen) case *Interface: - if tparamIsIface && isTypeParam(T) { - return t.IsComparable() - } - return true - case *TypeParam: - assert(!tparamIsIface) - return t.iface().IsComparable() + return !isTypeParam(T) || t.IsComparable() } return false } @@ -150,15 +144,7 @@ func hasNil(t Type) bool { case *Slice, *Pointer, *Signature, *Map, *Chan: return true case *Interface: - if tparamIsIface && isTypeParam(t) { - return u.typeSet().underIs(func(u Type) bool { - return u != nil && hasNil(u) - }) - } - return true - case *TypeParam: - assert(!tparamIsIface) - return u.underIs(func(u Type) bool { + return !isTypeParam(t) || u.typeSet().underIs(func(u Type) bool { return u != nil && hasNil(u) }) } |