]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: fix use of method values with stenciled methods
authorDan Scales <danscales@google.com>
Fri, 7 May 2021 20:20:34 +0000 (13:20 -0700)
committerDan Scales <danscales@google.com>
Wed, 12 May 2021 22:25:00 +0000 (22:25 +0000)
commit04f65d394c00cf706ba1e0949b057d94dace6b94
treebf91860a7ac8c2d7265968b5659b1aa557cfce5a
parentd2b3efcb90266c4d0abf11351f2ae947d13fbf55
[dev.typeparams] cmd/compile:  fix use of method values with stenciled methods

We were handling the case where an OFUNCINST node was used as a function
value, but not the case when an OFUNCINST node was used as a method
value. In the case of a method value, we need to create a new selector
expression that references the newly stenciled method.

To make this work, also needed small fix to noder2 code to properly set the
Sel of a method SelectorExpr (should be just the base method name, not
the full method name including the type string). This has to be correct,
so that the function created by MethodValueWrapper() can be typechecked
successfully.

Fixes #45817

Change-Id: I7343e8a0d35fc46b44dfe4d45b77997ba6c8733e
Reviewed-on: https://go-review.googlesource.com/c/go/+/319589
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/noder/expr.go
src/cmd/compile/internal/noder/stencil.go
test/typeparam/issue45817.go [new file with mode: 0644]