cmd/compile: fix type substituter to copy Funarg value for structs

We were missing copying the Funarg value when substituting for a struct
type.

Change-Id: Id0c2d9e55fb15987acb9edba6f74cf57cfd3417e
Reviewed-on: https://go-review.googlesource.com/c/go/+/347913
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
This commit is contained in:
Dan Scales 2021-09-07 07:46:27 -07:00
parent e581ec07ee
commit 6640171914

View file

@ -1229,7 +1229,7 @@ func (ts *Tsubster) typ1(t *types.Type) *types.Type {
newt = forw
}
if !newt.HasTParam() {
if !newt.HasTParam() && !newt.IsFuncArgStruct() {
// Calculate the size of any new types created. These will be
// deferred until the top-level ts.Typ() or g.typ() (if this is
// called from g.fillinMethods()).
@ -1324,7 +1324,9 @@ func (ts *Tsubster) tstruct(t *types.Type, force bool) *types.Type {
}
}
if newfields != nil {
return types.NewStruct(t.Pkg(), newfields)
news := types.NewStruct(t.Pkg(), newfields)
news.StructType().Funarg = t.StructType().Funarg
return news
}
return t