]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: add early a CONVIFACE normally created in the order phase
authorDan Scales <danscales@google.com>
Mon, 17 Jan 2022 21:24:06 +0000 (13:24 -0800)
committerDan Scales <danscales@google.com>
Wed, 19 Jan 2022 21:14:18 +0000 (21:14 +0000)
commitc1296af151f5682f6e0cd88cd0372aca5a464a97
treeb379c0482917ad9aca58d077892fd6def83a9250
parent1efc5815dd316953a8f37e58f7e3542a6aac3adf
cmd/compile: add early a CONVIFACE normally created in the order phase

Most CONVIFACEs are created in the transform phase (or old typechecker,
in -G=0 mode). But if the main result of a multi-value assignment (map,
channel, or dot-type) must be converted to an interface during the
assignment, that CONVIFACE is not created until (*orderState).as2ok in
the order phase (because the AS2* ops and their sub-ops are so tightly
intertwined). But we need to create the CONVIFACE during the
stenciling/transform phase to enable dictionary lookups. So, in
transformAssign(), if we are doing a special multi-value assignment
involving a type-param-derived type, assign the results first to temps,
so that we can manifest the CONVIFACE during the transform in assigning
the first temp to lhs[0].

Added a test for both AS2RECV (channel receives) and AS2MAPR (maps). I
don't think we can have a type assertion on a type-param-derived type.

Fixes #50642

Change-Id: I4d079fc46c93d8494d7db4ea8234d91522edb02a
Reviewed-on: https://go-review.googlesource.com/c/go/+/379054
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/noder/transform.go
test/typeparam/issue50642.go [new file with mode: 0644]