From: Tobias Klauser Date: Thu, 5 Oct 2023 15:29:49 +0000 (+0200) Subject: cmd/compile/internal/typecheck: use strings.Contains X-Git-Tag: go1.22rc1~519 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=884c93a6df07eb62efeaa44265b58936d3084dd7;p=gostls13.git cmd/compile/internal/typecheck: use strings.Contains Change-Id: I439268e91288f9a5a0946ac428731cdfa4d111cb Reviewed-on: https://go-review.googlesource.com/c/go/+/533135 TryBot-Result: Gopher Robot Run-TryBot: Tobias Klauser Reviewed-by: qiulaidongfeng <2645477756@qq.com> Auto-Submit: Tobias Klauser Reviewed-by: Matthew Dempsky LUCI-TryBot-Result: Go LUCI Reviewed-by: David Chase --- diff --git a/src/cmd/compile/internal/typecheck/expr.go b/src/cmd/compile/internal/typecheck/expr.go index 24c677e753..12d1743874 100644 --- a/src/cmd/compile/internal/typecheck/expr.go +++ b/src/cmd/compile/internal/typecheck/expr.go @@ -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) }