diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-06-23 00:31:16 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-06-23 16:48:23 +0000 |
commit | eb691fdd62c9f1dc36c9c9a974ac2ddad677fd99 (patch) | |
tree | 710880c1174408593cb2dbf3f037c276cfc0431c /test/escape5.go | |
parent | 0a0e3a3dea72d8d64d4250c9f7649da3b942eae5 (diff) | |
download | go-eb691fdd62c9f1dc36c9c9a974ac2ddad677fd99.tar.gz go-eb691fdd62c9f1dc36c9c9a974ac2ddad677fd99.zip |
[dev.typeparams] cmd/compile: escape analysis of method expression calls
This CL extends escape analysis to analyze function calls using method
expressions the same as it would a normal method call. That is, it now
analyzes "T.M(recv, args...)" the same as "recv.M(args...)".
This is useful because it means the frontend can eventually stop
supporting both function calls and method calls. We can simply desugar
method calls into function calls, like we already do in the backend to
simplify SSA construction.
Change-Id: I9cd5ec0d534cbcd9860f0014c86e4ae416920c26
Reviewed-on: https://go-review.googlesource.com/c/go/+/330331
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'test/escape5.go')
-rw-r--r-- | test/escape5.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/test/escape5.go b/test/escape5.go index 73acfb46a9..97aaf23b2d 100644 --- a/test/escape5.go +++ b/test/escape5.go @@ -180,8 +180,7 @@ func _() { } func fbad24305() { - // BAD u should not be heap allocated - var u U // ERROR "moved to heap: u" + var u U (*U).M(&u) (*U).N(&u) } |