]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: only look for struct type when crawling inline body
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 21 Oct 2021 07:31:40 +0000 (14:31 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 22 Oct 2021 00:57:18 +0000 (00:57 +0000)
commit9ff91b90988945c7bbe85fdef4a16d5f1af6b2c2
tree22c6c57b834d85f681667e27be58dc585aaebbfa
parent23e57e59556f42d6935b65be63b59a8b0fc0e6ad
cmd/compile: only look for struct type when crawling inline body

CL 356254 fixed crawling of embeddable types during inline. However, we
are too agressive, since when we call markEmbed for every type seen
during inlining function body. That leads to false positive that for a
non-embedded type, its unexported methods are also marked inline.

Instead, we should only look at struct type that we seen during inlining
function body, and calling markEmbed for all of its embedded fields.

Fixes #49094

Change-Id: I6ef9a8bf1fc649ec6bf75e4883f6031ec8560ba1
Reviewed-on: https://go-review.googlesource.com/c/go/+/357232
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/typecheck/crawler.go
test/fixedbugs/issue49094.dir/a.go [new file with mode: 0644]
test/fixedbugs/issue49094.dir/b.go [new file with mode: 0644]
test/fixedbugs/issue49094.dir/p.go [new file with mode: 0644]
test/fixedbugs/issue49094.go [new file with mode: 0644]