mirror of
https://github.com/golang/go
synced 2024-11-23 05:50:05 -07:00
249e51e5d9
CL 450136 made the compiler to be able to handle simple inlined calls in staticinit. However, it's missed a condition when checking substituting arg for param. If there's any non-trivial closures, it has captured one of the param, so the substitution could not happen. Fixes #56778 Change-Id: I427c9134e333e2f9af136c1a124da4d37d326f10 Reviewed-on: https://go-review.googlesource.com/c/go/+/451555 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com>
19 lines
293 B
Go
19 lines
293 B
Go
// Copyright 2022 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package a
|
|
|
|
type A struct {
|
|
New func() any
|
|
}
|
|
|
|
func NewA(i int) *A {
|
|
return &A{
|
|
New: func() any {
|
|
_ = i
|
|
return nil
|
|
},
|
|
}
|
|
}
|