]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] Don't check typecheck(3) on transform, so no need to export/import it
authorDan Scales <danscales@google.com>
Fri, 14 May 2021 23:35:04 +0000 (16:35 -0700)
committerDan Scales <danscales@google.com>
Mon, 24 May 2021 22:17:33 +0000 (22:17 +0000)
commitd48f6d9f6f1ee7099ad129552507903e191ad589
tree261a885d30efe6bafe1b6150fab107cd8aecb35c
parent4c50721cda74abbf7732638f39a23dfbf6271a48
[dev.typeparams] Don't check typecheck(3) on transform, so no need to export/import it

We have a value typecheck(3) that indicates that a node in a generic
function still needs transformation (via the functions in transform.go).
But it is not very desirable to export/import the value of typecheck(3).
So, I changed the stenciling code to just try to transform all relevant
node types during node copy. Almost all tranform functions were already
idempotent. I only had to add an extra if check before calling
transformAssign() in the OAS case. We still use the typecheck(3) in
noder to determine when higher-nodes have to delay transformation
because one or more of their args are delaying transformation.

Added new test mapsimp.go that required these tranformations after import.

As an additional change, export/import of OINDEX requires exporting the
type using w.exoticType() rather than w.typ(), in order to handle
generic functions. Since generic functions can have pre-transform
operations, the index operation can have a tuple type (multiple return
from a map lookup).

Added printing of imported function bodies in -W=3 debug mode.

Change-Id: I220e2428dc5f2741e91db146f075eb5b6045f451
Reviewed-on: https://go-review.googlesource.com/c/go/+/322191
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/compile/internal/noder/stencil.go
src/cmd/compile/internal/typecheck/iexport.go
src/cmd/compile/internal/typecheck/iimport.go
test/typeparam/mapsimp.dir/a.go [new file with mode: 0644]
test/typeparam/mapsimp.dir/main.go [new file with mode: 0644]
test/typeparam/mapsimp.go [new file with mode: 0644]