From 66401719143692f1b892fb47aaef286f885395c9 Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Tue, 7 Sep 2021 07:46:27 -0700 Subject: [PATCH] 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 TryBot-Result: Go Bot Reviewed-by: Keith Randall Trust: Dan Scales --- src/cmd/compile/internal/typecheck/subr.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/typecheck/subr.go b/src/cmd/compile/internal/typecheck/subr.go index 4696b62cd2..d0ae529596 100644 --- a/src/cmd/compile/internal/typecheck/subr.go +++ b/src/cmd/compile/internal/typecheck/subr.go @@ -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 -- 2.48.1