diff options
author | Matthew Dempsky <mdempsky@google.com> | 2022-06-29 17:16:46 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2022-06-30 18:41:26 +0000 |
commit | 95d7ce9ab1dea5dface92736305470965a41f61e (patch) | |
tree | 42ac88db1532e11ed4fe39ceae579d13eec95ea4 /test/escape_iface.go | |
parent | f751319a0b51b9557a2f7f6000e692769f78da01 (diff) | |
download | go-95d7ce9ab1dea5dface92736305470965a41f61e.tar.gz go-95d7ce9ab1dea5dface92736305470965a41f61e.zip |
[dev.unified] test: break escape_iface.go into unified/nounified variants
The assignment `sink, *(&ok) = y.(int)` should (and does) escape a
value to the heap, but this detail is missed because the implicit
conversion of the multi-value expression `y.(int)` isn't visible to
escape analysis (because it's not inserted until desugaring during
walk).
For Unified IR, I plan to apply this desugaring earlier (because it's
necessary for correct dictionary handling), which means we'll
now (correctly) report the heap escape.
Due to limitations of the $GOROOT/test harness, the easiest way to
handle that GOEXPERIMENT=unified gets this right while
GOEXPERIMENT=nounified does not is to split the test case into
separate files. Hence this CL.
Change-Id: I91f3a6c015cbc646ab018747e152cac2874cf24c
Reviewed-on: https://go-review.googlesource.com/c/go/+/415241
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'test/escape_iface.go')
-rw-r--r-- | test/escape_iface.go | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/test/escape_iface.go b/test/escape_iface.go index dba08e3cb3..986228129a 100644 --- a/test/escape_iface.go +++ b/test/escape_iface.go @@ -235,16 +235,6 @@ func dotTypeEscape2() { // #13805, #15796 *(&v), *(&ok) = y.(int) } { - i := 0 - j := 0 - var ok bool - var x interface{} = i // ERROR "i does not escape" - var y interface{} = j // ERROR "j does not escape" - - sink = x.(int) // ERROR "x.\(int\) escapes to heap" - sink, *(&ok) = y.(int) - } - { i := 0 // ERROR "moved to heap: i" j := 0 // ERROR "moved to heap: j" var ok bool |