diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-06-14 19:21:14 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-06-16 17:32:49 +0000 |
commit | 132ea56d292eac0226eef4bc32d784b0300c3bce (patch) | |
tree | b3158a88a1ccfe5e1bed716e952e318b81294e9c /src/cmd/compile/internal/gc/main.go | |
parent | 8f95eaddd334e61b1832628741b97462ddc84975 (diff) | |
download | go-132ea56d292eac0226eef4bc32d784b0300c3bce.tar.gz go-132ea56d292eac0226eef4bc32d784b0300c3bce.zip |
[dev.typeparams] cmd/compile: fix crawling of embeddable types
In reflectdata, we have a hack to only apply inlining for (*T).M
wrappers generated around T.M. This was a hack because I didn't
understand at the time why other cases were failing.
But I understand now: during export, we generally skip exporting the
inline bodies for unexported methods (unless they're reachable through
some other exported method). But it doesn't take into account that
embedding a type requires generating wrappers for promoted methods,
including imported, unexported methods.
For example:
package a
type T struct{}
func (T) m() {} // previously omitted by exported
package b
import "./a"
type U struct { a.T } // needs U.m -> T.m wrapper
This CL adds extra logic to the crawler to recognize that T is an
exported type directly reachable by the user, so *all* of its methods
need to be re-exported.
This finally allows simplifying reflectdata.methodWrapper to always
call inline.InlineCalls.
Change-Id: I25031d41fd6b6cd69d31c6a864b5329cdb5780e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/327872
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/gc/main.go')
0 files changed, 0 insertions, 0 deletions