diff options
author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2022-06-29 02:05:21 +0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2022-07-06 20:29:10 +0000 |
commit | 1243ec9c177007879958443262fe4d25099c5ede (patch) | |
tree | a9cea00fd8d372a1974f030db5853d3826920b94 | |
parent | c391156f96357593fa18fccee305401e3f82a1a6 (diff) | |
download | go-1243ec9c177007879958443262fe4d25099c5ede.tar.gz go-1243ec9c177007879958443262fe4d25099c5ede.zip |
cmd/compile: only check implicit dots for method call enabled by a type bound
Fixes #53419
Change-Id: Ibad64f5c4af2112deeb0a9ecc9c589b17594bd05
Reviewed-on: https://go-review.googlesource.com/c/go/+/414836
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
-rw-r--r-- | src/cmd/compile/internal/noder/stencil.go | 14 | ||||
-rw-r--r-- | test/run.go | 1 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go index cf2f0b38db..796a740528 100644 --- a/src/cmd/compile/internal/noder/stencil.go +++ b/src/cmd/compile/internal/noder/stencil.go @@ -1654,12 +1654,14 @@ func (g *genInst) getDictionarySym(gf *ir.Name, targs []*types.Type, isMeth bool se := call.X.(*ir.SelectorExpr) if se.X.Type().IsShape() { // This is a method call enabled by a type bound. - - // We need this extra check for method expressions, - // which don't add in the implicit XDOTs. - tmpse := ir.NewSelectorExpr(src.NoXPos, ir.OXDOT, se.X, se.Sel) - tmpse = typecheck.AddImplicitDots(tmpse) - tparam := tmpse.X.Type() + tparam := se.X.Type() + if call.X.Op() == ir.ODOTMETH { + // We need this extra check for method expressions, + // which don't add in the implicit XDOTs. + tmpse := ir.NewSelectorExpr(src.NoXPos, ir.OXDOT, se.X, se.Sel) + tmpse = typecheck.AddImplicitDots(tmpse) + tparam = tmpse.X.Type() + } if !tparam.IsShape() { // The method expression is not // really on a typeparam. diff --git a/test/run.go b/test/run.go index 8934e23b38..cb1622ccc9 100644 --- a/test/run.go +++ b/test/run.go @@ -1966,7 +1966,6 @@ var types2Failures32Bit = setOf( var go118Failures = setOf( "typeparam/nested.go", // 1.18 compiler doesn't support function-local types with generics "typeparam/issue51521.go", // 1.18 compiler produces bad panic message and link error - "typeparam/issue53419.go", // 1.18 compiler mishandles generic selector resolution ) // In all of these cases, the 1.17 compiler reports reasonable errors, but either the |