-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: inconsistent behaviors in judging whether or not two types are identical #24721
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
Comments
btw, should |
The following program print the same output for the two types:
I feel the outputs are wrong, at least the outputs should be But I change the type
|
A simpler repro does not require separate packages: https://play.golang.org/p/_ZimDvvVU0u The compiler is correct to emit an error, because the fields of the two struct types have different names ( |
The fix is presumably to use the name of the field in the error message instead of the name of the underlying type. |
(CC @griesemer, maybe?) |
If the error messages are correct, the problem is bigger:
|
Huh, that's a neat bug you've found! |
reduced further https://play.golang.org/p/m6Wv1Hk1U8h |
|
Too late for 1.12. |
@bcmills they are not totally the same. The unequalness in this issue is because the field names are different. |
This issue is currently labeled as early-in-cycle for Go 1.15. That time is now, so friendly ping. If it no longer needs to be done early in cycle, that label can be removed. |
One more difference between gc and gccgo:
It compiles ok with gc, but not gccgo. |
As the line |
This issue is currently labeled as early-in-cycle for Go 1.16. |
This didn't make it for Go 1.16. Should try to address for Go 1.17, certainly for 1.18. As already explained we need to fix the printing of structs, both for error messages (to make clear what's wrong), and for generating type descriptors. Probably not too hard to do but the respective code is in |
For reference:
|
This issue is currently labeled as early-in-cycle for Go 1.17. |
Again, given other priorities, this didn't make it for 1.17. Pushing to 1.18. |
This issue is currently labeled as early-in-cycle for Go 1.18. |
@griesemer I assume that we should push this to 1.19? |
Moved to 1.19. |
It looks this bug has been fixed in https://golang.org/cl/378434, for #50190. |
@mdempsky Is there anything left to do here? |
@dotaheor Thanks for pointing that out. @griesemer I don't think so. I looked over the failure cases, and I don't think they add anything significant beyond ones we already added for #50190. Closing. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.1 linux/amd64
Does this issue reproduce with the latest release?
yes
What did you do?
What did you expect to see?
No errors, [edit: or all
println
calls, except the second, printfalse
].What did you see instead?
The text was updated successfully, but these errors were encountered: