-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
x/tools/gopls: handle go1.22's go/types.Alias #64581
Comments
Change https://go.dev/cl/547876 mentions this issue: |
I tested gopls using tip GOROOT after hardwiring types.Checker.enablealias to true. (We can't use GODEBUG=gotypesalias=1 to control it yet because this environment variable would be inherited by 'go list' and the Go compiler, which doesn't yet have support for writing out Alias types, so it crashes.) I added rudimentary support to the gcimporter package used by gopls for reading and writing aliases, and sprinkled lots of Unalias operations throughout the tree, and was able to get all but three tests (of vulncheck and staticheck) to pass. So I think it's in good shape for the 1.22 release, though we have a lot of work to do after the release. |
Change https://go.dev/cl/574717 mentions this issue: |
Change https://go.dev/cl/574737 mentions this issue: |
This CL adds support for preserving materialized aliases while types transit export data (indexed or unified). (This CL depends on CL 574737 to the compiler and go/types.) Updates golang/go#65294 Updates golang/go#64581 Change-Id: I1a0a08357e4f6a480ba6250fbea327922e455873 Reviewed-on: https://go-review.googlesource.com/c/tools/+/574717 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
This CL changes the compiler's type import/export logic to create and preserve materialized Alias types when GODEBUG=gotypesaliases=1. In conjunction with CL 574717, it allows the x/tools tests to pass with GODEBUG=gotypesaliases=1. Updates #65294 Updates #64581 Fixes #66550 Change-Id: I70b9279f4e0ae7a1f95ad153c4e6909a878915a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/574737 Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
Change https://go.dev/cl/577576 mentions this issue: |
Change https://go.dev/cl/579756 mentions this issue: |
This test reenables the staticcheck test, which now passes with gotypesalias={,0,1}. (Staticcheck may yet need work, but that isn't evident to our tests.) Updates golang/go#64581 Change-Id: I1c8acca2c6b7d16e551a5c8a68be564254713d0d Reviewed-on: https://go-review.googlesource.com/c/tools/+/579756 Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
Change https://go.dev/cl/580455 mentions this issue: |
The predicate that determines whether the type checker creates types.Alias nodes is complex: it depends on an environment variable (GODEBUG) that is somewhat tricky to parse correctly, since it is a rightmost-wins list. Critically, however, its default value is a function of the go directive in the application's go.mod file, which is inaccessible to logic in x/tools (per-file build tags can detect the toolchain version, but not the go.mod version). Equally critically, the current effective value of the gotypesalias variable changes when os.Setenv(GODEBUG) is called, which happens in tests, and there is no way to detect those events; therefore any attempt to cache the value is wrong. This change exposes a simplified version of the Enabled function from aliases, which always computes the ground truth by invoking the type checker, regardless of cost. It also adds an 'enabled' parameter to NewAlias so that callers can amortize this cost. Also, various minor cleanups related to aliases. Updates golang/go#64581 Change-Id: If926edefb8e1c1f63c17e4fad0a808e27bac6d5b Reviewed-on: https://go-review.googlesource.com/c/tools/+/580455 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
Is this now completed? |
Yeah, I think so. Never has the Close button felt so good to press. |
Change https://go.dev/cl/577657 mentions this issue: |
stringintconv will return the alias name if available. Make the test agnostic. Updates golang/go#64581 Change-Id: I47d245c62f45cd6c02f45ba5eb770318dcb7cbec Reviewed-on: https://go-review.googlesource.com/c/tools/+/577657 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
Change https://go.dev/cl/600135 mentions this issue: |
See review comment on CL 580455. Updates golang/go#64581 Change-Id: Ic992a1bf5388ce221a9883f49820c7a9ae85b4d0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/600135 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Alan Donovan <[email protected]> Reviewed-by: Robert Findley <[email protected]>
This issue tracks the adoption in gopls of go1.22's new types.Alias type. We will need to audit every place that type-switches or type-asserts a
types.Type
to ensure that it works correctly with the new type. Initially the type checker will not produce instances of these types unless GODEBUG=gotypesalias=1 is set.Things to resolve:
Related:
@gri @findleyr
The text was updated successfully, but these errors were encountered: