aboutsummaryrefslogtreecommitdiff
path: root/test/method7.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2018-04-05 22:42:16 -0700
committerMatthew Dempsky <mdempsky@google.com>2018-04-06 15:39:11 +0000
commit950a56899aaf48da9691fbbfb8f48328863e02fa (patch)
tree96d5a65cc97e657a6eaf9ecb35ee2dfadbd69620 /test/method7.go
parent84b784a84f89f94ceae952743aa447a6a9c95f32 (diff)
downloadgo-950a56899aaf48da9691fbbfb8f48328863e02fa.tar.gz
go-950a56899aaf48da9691fbbfb8f48328863e02fa.zip
cmd/compile: fix method expressions with anonymous receivers
Method expressions with anonymous receiver types like "struct { T }.m" require wrapper functions, which we weren't always creating. This in turn resulted in linker errors. This CL ensures that we generate wrapper functions for any anonymous receiver types used in a method expression. Fixes #22444. Change-Id: Ia8ac27f238c2898965e57b82a91d959792d2ddd4 Reviewed-on: https://go-review.googlesource.com/105044 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'test/method7.go')
-rw-r--r--test/method7.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/method7.go b/test/method7.go
index 72c88b377d..15e123e85f 100644
--- a/test/method7.go
+++ b/test/method7.go
@@ -45,10 +45,9 @@ func main() {
interface{ m1(string) }.m1(x, "d")
want += " m1(d)"
- // cannot link the call below - see #22444
- // g := struct{ T }.m2
- // g(struct{T}{})
- // want += " m2()"
+ g := struct{ T }.m2
+ g(struct{ T }{})
+ want += " m2()"
if got != want {
panic("got" + got + ", want" + want)