go/internal/gcimporter: don't use Interface.EmbeddedType for builds before go1.11

For https://github.com/golang/lint/issues/402.

Change-Id: I3f4eab123e52460980e76f5ffaca3a77a3af7374
Reviewed-on: https://go-review.googlesource.com/118565
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Robert Griesemer 2018-06-13 11:25:52 -07:00
parent 6f857df7d4
commit e580e344d4
3 changed files with 9 additions and 1 deletions

View File

@ -336,7 +336,7 @@ func verifyInterfaceMethodRecvs(t *testing.T, named *types.Named, level int) {
// check embedded interfaces (if they are named, too)
for i := 0; i < iface.NumEmbeddeds(); i++ {
// embedding of interfaces cannot have cycles; recursion will terminate
if etype, _ := iface.EmbeddedType(i).(*types.Named); etype != nil {
if etype, _ := embeddedType(iface, i).(*types.Named); etype != nil {
verifyInterfaceMethodRecvs(t, etype, level+1)
}
}

View File

@ -19,3 +19,7 @@ func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interfac
}
return types.NewInterface(methods, named)
}
func embeddedType(iface *types.Interface, i int) types.Type {
return iface.Embedded(i)
}

View File

@ -11,3 +11,7 @@ import "go/types"
func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface {
return types.NewInterface2(methods, embeddeds)
}
func embeddedType(iface *types.Interface, i int) types.Type {
return iface.EmbeddedType(i)
}