]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: only check implicit dots for method call enabled by a type bound
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 28 Jun 2022 19:05:21 +0000 (02:05 +0700)
committerKeith Randall <khr@golang.org>
Wed, 6 Jul 2022 20:29:10 +0000 (20:29 +0000)
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>

src/cmd/compile/internal/noder/stencil.go
test/run.go

index cf2f0b38db3e85c522dee02ace88b70c8cdf2846..796a74052863176d404e6ef74b5848fdf2eb4eaa 100644 (file)
@@ -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.
index 8934e23b3857a1a64a2f5e9bd932626a459438be..cb1622ccc9763d3504ce09efce109ea72662e2c4 100644 (file)
@@ -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