1
0
mirror of https://github.com/golang/go synced 2024-11-19 18:44:41 -07:00

cmd/compile: omit unnecessary interface method expression wrappers

We'll always generate method expression wrappers for declared
interface types in their own package, so no need to generate them in
downstream packages.

Noticed by gri@ while looking into #21282.

Change-Id: I4fb7051b4e15297933da05fdd2b111d6b8f4178e
Reviewed-on: https://go-review.googlesource.com/106175
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Matthew Dempsky 2018-04-10 15:13:49 -07:00
parent 607953609c
commit 80bbad015d

View File

@ -1633,6 +1633,11 @@ func genwrapper(rcvr *types.Type, method *types.Field, newnam *types.Sym) {
return
}
// Only generate I.M wrappers for I in I's own package.
if rcvr.IsInterface() && rcvr.Sym != nil && rcvr.Sym.Pkg != localpkg {
return
}
lineno = autogeneratedPos
dclcontext = PEXTERN