mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: fix delayTransform condition
The delayTransform only checks whether ir.CurFunc is generic function or not. but when compiling a non-generic closure inside a generic function, we also want to delay the transformation, which delayTransform fails to detect, since when ir.CurFunc is the closure, not the top level function. Instead, we must rely on irgen.topFuncIsGeneric field to decide whether to delay the transformation, the same logic with what is being done for not adding closure inside a generic function to g.target.Decls list. Fixes #48609 Change-Id: I5bf5592027d112fe8b19c92eb906add424c46507 Reviewed-on: https://go-review.googlesource.com/c/go/+/351855 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
c94543b85f
commit
cfd0868fc3
5 changed files with 34 additions and 16 deletions
|
|
@ -319,3 +319,9 @@ func (g *irgen) unhandled(what string, p poser) {
|
|||
base.FatalfAt(g.pos(p), "unhandled %s: %T", what, p)
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
// delayTransform returns true if we should delay all transforms, because we are
|
||||
// creating the nodes for a generic function/method.
|
||||
func (g *irgen) delayTransform() bool {
|
||||
return g.topFuncIsGeneric
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue