]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix delayTransform condition
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 24 Sep 2021 16:11:18 +0000 (23:11 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 24 Sep 2021 19:40:03 +0000 (19:40 +0000)
commitcfd0868fc3252e349b11066ed300c389d4495587
treef86015025b8daaa9257959f31ca229a07c6cb55e
parentc94543b85fe6f41dc3bc1725f928c6ed98d8d72c
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>
src/cmd/compile/internal/noder/expr.go
src/cmd/compile/internal/noder/helpers.go
src/cmd/compile/internal/noder/irgen.go
src/cmd/compile/internal/noder/stmt.go
test/typeparam/issue48609.go [new file with mode: 0644]