The CONVIFACE that is needed to convert "<- ch.(<-chan T)" (which has type T) to any (empty interface, the type of temp) is currently being created only during the walk phase, but we need it to be created during the transforms after instantiation, so it is available during the dictionary pass. I can fix the transform pass to do that, but it may be a bit tricky, because of the tight connection between the AS2RECV and RECV operations. I looks like we have a similar problem with AS2MAPR and AS2DOTTYPE (when the first rhs is implicitly being converted to an interface from a type-param-derived type).
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.
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.
Reviewed-by: Matthew Dempsky <email@example.com>
Trust: Dan Scales <firstname.lastname@example.org>
Run-TryBot: Dan Scales <email@example.com>
TryBot-Result: Gopher Robot <firstname.lastname@example.org>