cmd/compile: inconsistent behaviors in judging whether or not two types are identical #24721
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. |
A similar bug of gc?
|
@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:
|
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: