1
0
mirror of https://github.com/golang/go synced 2024-11-16 17:04:41 -07:00

cmd/compile/internal/typecheck: use strings.Contains

Change-Id: I439268e91288f9a5a0946ac428731cdfa4d111cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/533135
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Tobias Klauser 2023-10-05 17:29:49 +02:00 committed by Gopher Robot
parent 067f28ad73
commit 884c93a6df

View File

@ -241,7 +241,7 @@ func tcCompLit(n *ir.CompLitExpr) (res ir.Node) {
// walkClosure(), because the instantiated
// function is compiled as if in the source
// package of the generic function.
if !(ir.CurFunc != nil && strings.Index(ir.CurFunc.Nname.Sym().Name, "[") >= 0) {
if !(ir.CurFunc != nil && strings.Contains(ir.CurFunc.Nname.Sym().Name, "[")) {
if s != nil && !types.IsExported(s.Name) && s.Pkg != types.LocalPkg {
base.Errorf("implicit assignment of unexported field '%s' in %v literal", s.Name, t)
}