From d48f6d9f6f1ee7099ad129552507903e191ad589 Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Fri, 14 May 2021 16:35:04 -0700 Subject: [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 Run-TryBot: Dan Scales Reviewed-by: Keith Randall TryBot-Result: Go Bot --- src/cmd/compile/internal/typecheck/iexport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd/compile/internal/typecheck/iexport.go') diff --git a/src/cmd/compile/internal/typecheck/iexport.go b/src/cmd/compile/internal/typecheck/iexport.go index d956ada3c5..292bb2c409 100644 --- a/src/cmd/compile/internal/typecheck/iexport.go +++ b/src/cmd/compile/internal/typecheck/iexport.go @@ -1735,7 +1735,7 @@ func (w *exportWriter) expr(n ir.Node) { w.expr(n.X) w.expr(n.Index) if go117ExportTypes { - w.typ(n.Type()) + w.exoticType(n.Type()) if n.Op() == ir.OINDEXMAP { w.bool(n.Assigned) } -- cgit v1.2.3-54-g00ecf