-
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: impure type set used in value type #60117
Comments
cc @golang/compiler tip comes with a stacktrace:
|
Thanks for the report. Your code is valid and should work. I'm sorry that it doesn't. This is a little nuanced, but the issue here is that your defined type Variable is a "pure" interface, but it embeds a non-pure interface (Number). This should be allowed, but hits an unexpected code path today. You can workaround this by simplifying |
You're welcome! Nice to know I was on track. That's basically what I ended up doing. thanks for the notes! |
Change https://go.dev/cl/495455 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes. Confirmed with v1.20.4.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Just experimenting with using generics to solve some design pattern conveniences and discovered that I apparently need to file this bug report, so that's what this bug report is about.
Here's a short program demonstrating the problem case.
What did you expect to see?
Dunno exactly, still wrapping my brain around the generics thing and this was simply exploration through experimentation. The short program was extracted from the work I'm doing on a much larger project, which means I must be confused about the rules of generics and need to scale things back a bit.
What did you see instead?
The text was updated successfully, but these errors were encountered: