]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fix export/import of range loop.
authorDan Scales <danscales@google.com>
Sun, 19 Sep 2021 16:23:21 +0000 (09:23 -0700)
committerDan Scales <danscales@google.com>
Mon, 20 Sep 2021 00:13:47 +0000 (00:13 +0000)
commita83a5587331392fc9483d183e446586b463ad8aa
treede595f2e4e9c85f89ff71f46ddb5befc21794847
parent315dbd10c90db3b41af2c975a5fbfa2ec7615c1b
cmd/compile: fix export/import of range loop.

As with other recent issues, the Init field of a range loop was not
being handled properly. Generally, it is much better to explicitly
import/export the Init statements, else they are incorrectly added
before the associated node, rather than as the Init value of the node.
This was causing labels to not be correctly added to the range loop that
it is immediately preceding.

Made the ORANGE handling completely similar to the OFOR handling.

Fixes #48462

Change-Id: I999530e84f9357f81deaa3dda50660061f710e7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/350911
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
src/cmd/compile/internal/typecheck/iexport.go
src/cmd/compile/internal/typecheck/iimport.go
test/typeparam/issue48462.dir/a.go [new file with mode: 0644]
test/typeparam/issue48462.dir/main.go [new file with mode: 0644]
test/typeparam/issue48462.go [new file with mode: 0644]