1
0
mirror of https://github.com/golang/go synced 2024-11-23 02:10:03 -07:00

[dev.typeparams] go/types: remove unnecessary guard from NewInterfaceType

This is a partial port of CL 322609, containing only changes to
go/types. Importer changes will be made in a separate CL.

Change-Id: I50af3c1ed5e949bb28a3462d717c0eb29a5f31ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/335144
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Rob Findley 2021-07-16 14:54:21 -04:00 committed by Robert Findley
parent b96f1b9419
commit 22a38ba5ca

View File

@ -72,17 +72,6 @@ func NewInterfaceType(methods []*Func, embeddeds []Type) *Interface {
} }
} }
// TODO(rfindley): this guard is not present in types2. Remove it?
// All embedded types should be interfaces; however, defined types
// may not yet be fully resolved. Only verify that non-defined types
// are interfaces. This matches the behavior of the code before the
// fix for #25301 (issue #25596).
for _, t := range embeddeds {
if _, ok := t.(*Named); !ok && !IsInterface(t) {
panic("embedded type is not an interface")
}
}
// sort for API stability // sort for API stability
sortMethods(methods) sortMethods(methods)