-
Notifications
You must be signed in to change notification settings - Fork 18k
go/types: var declaration changes representation of its type (alias related) #66704
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
FWIW, putting this in go/types/testdata/manual.go and running |
Unalias is sticky. If called too soon on a type that's part of a cycle of declarations, it latches on to the invalid type which is destined to be updated, but too late. I guess that the var declaration calls Unalias on T[B]. |
Not memoizing Unalias if the actual type is Invalid makes the test pass. Not sure whether that's a fix or a hack. |
Hmm, this is a tale as old as time, and gives me flashbacks to Named.Underlying and Named.Method, with generics. It took a lot of careful work to ensure that we don't touch the underlying or methods of instances until the type is fully set up. (but this type of problem didn't start with generics; I believe we had similar problems with method set completeness). I suspect this may be very nontrivial to fix. Absent a formal partial ordering of type checking operations, the work tends to be whack-a-mole, delaying operations.
Sigh, we can change Alias.cleanup to say "really Unalias though". |
That may actually be a reasonable solution, for now. Perhaps pre-existing code used CC @griesemer |
Change https://go.dev/cl/576975 mentions this issue: |
Change https://go.dev/cl/579015 mentions this issue: |
This CL ports to types2 the (passing) test from CL 576975, which fixed a bug in go/types. Updates #66704 Updates #65294 Change-Id: Icdf77e39ed177d9f9ecc435d5125f02f2ee4dd0f Reviewed-on: https://go-review.googlesource.com/c/go/+/579015 Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
Change https://go.dev/cl/579075 mentions this issue: |
Follow-up on CL 576975 and CL 579015. Updates #66704 Updates #65294 Change-Id: Ied95386a346be38ccda86d332d09b2089a68c5e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/579075 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Auto-Submit: Robert Griesemer <[email protected]> Reviewed-by: Robert Findley <[email protected]>
This is a minimized repro of another gotypesalias=1 problem affecting the x/tools gcimporter.
The root cause is clearly in go/types (at b24ec88).
The text was updated successfully, but these errors were encountered: