-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: internal compiler error: shape types have no methods go.shape.int_0 #50642
Comments
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). |
Change https://golang.org/cl/379054 mentions this issue: |
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 golang#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>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
https://go.dev/play/p/L0FDK8tRORW?v=gotip
or
https://gotipplay.golang.org/p/L0FDK8tRORW
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://go.dev/play/p/L0FDK8tRORW?v=gotip
or
https://gotipplay.golang.org/p/L0FDK8tRORW
What did you expect to see?
panic: interface conversion: interface {} is nil, not <-chan int
What did you see instead?
./main.go:17:14: internal compiler error: shape types have no methods go.shape.int_0
The text was updated successfully, but these errors were encountered: