diff options
| author | Tobias Klauser <tklauser@distanz.ch> | 2023-10-05 17:29:49 +0200 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-10-25 17:37:01 +0000 |
| commit | 884c93a6df07eb62efeaa44265b58936d3084dd7 (patch) | |
| tree | 43ca345cc0ba0f231861abc6cceaed60fd5ac303 /src | |
| parent | 067f28ad73e096a7ca1e892ba89280dfa4fa419d (diff) | |
| download | go-884c93a6df07eb62efeaa44265b58936d3084dd7.tar.xz | |
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>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/typecheck/expr.go | 2 |
1 files changed, 1 insertions, 1 deletions
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) } |
