-
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: panic running code that uses generic interface value #51303
Comments
At first glance this does seem to be a bug in the dictionary code somewhere. |
This is an interesting issue. I haven't totally figured out all the details, but it relates to the way we create shape types for instantiations. The complex case here is when we already have a shape type, then we construct a new compound type from that that shape, and we end up using that as a type arg to another generic function. I think we're not always handling things correctly in the case where the type arg has a shape type in it, but is not a top-level shape type (i.e. we have a shape type S, and compound type arg we are passing to another generic function is []S). |
I have a rough fix. Will need to think on it a bit more and discuss with @randall77 . |
Change https://go.dev/cl/387674 mentions this issue: |
Keith and I are still discussing the most complete way to fix this. |
We convert type args to shape types inside instantiations. If an instantiation constructs a compound type based on that shape type and uses that as a type arg to another generic function being called, then we have a type arg with a shape type embedded inside of it. In that case, we need to substitute out those embedded shape types with their underlying type. If we don't do this, we may create extra unneeded shape types that have these other shape types embedded in them. This may lead to generating extra shape instantiations, and a mismatch between the instantiations that we used in generating dictionaries and the instantations that are actually called. Updates #51303 Change-Id: Ieef894a5fac176cfd1415f95926086277ad09759 Reviewed-on: https://go-review.googlesource.com/c/go/+/387674 Reviewed-by: Keith Randall <[email protected]> Trust: Dan Scales <[email protected]> Run-TryBot: Dan Scales <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
I have submitted my fix, after discussion with Keith and some extra prototyping. This issue still needs to be investigated for Go 1.19 (best way to deal with these types created from shape types), but removing it from release blocker. |
Sounds good, thanks. |
@randall77 What is the current status here? This issue is currently in the 1.19 milestone. Should it move to 1.20? To Backlog? Thanks. |
I don't think there's anything actionable here right now. I'm going to close. Please feel free to reopen if we have a compileable reproducer. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
gotip playground also fails
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://gotipplay.golang.org/p/Gg7oSlfPoHI
What did you expect to see?
no error
What did you see instead?
It appears to fail on:
if x.Equal(xe, ye) {
Although if you comment out the following append line, then it passes.
In the gotip playground it gives:
On my Mac it gives:
runtime: unexpected return pc for runtime.sigpanic
The text was updated successfully, but these errors were encountered: