]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: always remove receiver type from instantiated method values
authorKeith Randall <khr@golang.org>
Fri, 20 Aug 2021 23:15:53 +0000 (16:15 -0700)
committerKeith Randall <khr@golang.org>
Mon, 23 Aug 2021 19:27:46 +0000 (19:27 +0000)
commit3081f817da8c194982596ddddf5d3ec321c859af
tree75122cd8b260c224a9d35a5d0e474a3e5a11a149
parent8486ced8b09f4425bfd85e09b021dc78f93aea08
cmd/compile: always remove receiver type from instantiated method values

If a type T has a method foo, then

var t T
var i interface{} = t.foo

The type of foo is a method type, but the type of t.foo should be a
standard function type. Make sure we always do that conversion.

Fixes #47775

Change-Id: I464ec792196b050aba1914e070a4ede34bfd0bfa
Reviewed-on: https://go-review.googlesource.com/c/go/+/343881
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
src/cmd/compile/internal/noder/transform.go
src/cmd/compile/internal/typecheck/dcl.go
test/typeparam/issue47775.dir/b.go [new file with mode: 0644]
test/typeparam/issue47775.dir/main.go [new file with mode: 0644]
test/typeparam/issue47775.go [new file with mode: 0644]
test/typeparam/issue47775b.go [new file with mode: 0644]