aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/type.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-06-29 12:22:21 -0700
committerRobert Griesemer <gri@golang.org>2021-07-01 16:42:34 +0000
commit9cb1b0f50b5852b24e1a7b66f09faa1a521ae108 (patch)
tree72da1e367ffd794a681c2b5e08ed80cc28000fd3 /src/cmd/compile/internal/types2/type.go
parent1cd505c353e4656ba28fd8de8708e8c8e6c21cbf (diff)
downloadgo-9cb1b0f50b5852b24e1a7b66f09faa1a521ae108.tar.gz
go-9cb1b0f50b5852b24e1a7b66f09faa1a521ae108.zip
[dev.typeparams] cmd/compile/internal/types2: delay interface check for type bounds
While at it, clean up code for collecting/declaring type parameters. For #40789. Change-Id: I0855137d5ee85c0ae2fa60d33b28c24a33132fbc Reviewed-on: https://go-review.googlesource.com/c/go/+/331690 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/type.go')
-rw-r--r--src/cmd/compile/internal/types2/type.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types2/type.go b/src/cmd/compile/internal/types2/type.go
index 2cfcabbdb5..05e6d77d22 100644
--- a/src/cmd/compile/internal/types2/type.go
+++ b/src/cmd/compile/internal/types2/type.go
@@ -626,7 +626,11 @@ func (t *TypeParam) SetId(id uint64) {
}
func (t *TypeParam) Bound() *Interface {
- iface := asInterface(t.bound)
+ // we may not have an interface (error reported elsewhere)
+ iface, _ := under(t.bound).(*Interface)
+ if iface == nil {
+ return &emptyInterface
+ }
// use the type bound position if we have one
pos := nopos
if n, _ := t.bound.(*Named); n != nil {