CL 567837 deleted mkstdlib.go (a generator) and zstdlib.go (its output).
For golang/go#46136.
For golang/go#38706.
Change-Id: If5623e3ab014c2fee63b1d058c726ea5acb06aa2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/571276
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
slices has been supported in go1.21 and go1.22
Fixesgolang/go#66222
Change-Id: I7b319e649632a713200dcaabd1e68d1f01e1b2f2
GitHub-Last-Rev: fc1d59d86a
GitHub-Pull-Request: golang/tools#484
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572116
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Update the canRemoveParameter logic to reflect that we don't try to
remove parameters when there are parse or type errors.
Change-Id: Ia8239a383b56763d100c69c9a3633c87025b81cf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572297
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Make a minimal change to the removeparam algorithm to support removing
unused parameters of methods.
This doesn't address the problem of expanding the set of signatures or
calls based on interface satisfaction constraints: that is really a
separate concern, which also affects method renaming (golang/go#58461).
Were we to have a more general solution to that problem, it would be
relatively straightforward to also expand the change signature
algorithm.
For golang/go#38028
Change-Id: I296cb1f828f07d841c83b1fd33593ccd2fee3539
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572296
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Unbreak the x/tools build dashboard due to a semantic conflict between
CL 572475 and CL 571215.
Change-Id: I8ce1308ee99e75aa7cf8f7bd1d8b1dedcb845f4d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572515
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL moves the stdversion analyzer out of gopls,
into the exported analyzer tree, whence it will be
vendored into cmd/vet in a follow-up.
Updates golang/go#46136
Change-Id: I039ef78ecdcfd6bc64d5b089017a9b8635cf9aa5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572035
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL adds a "View package documentation" code action to any
selection in a Go source file. Its command has two effects:
1) to start a web server associated with the current LSP
server, with coupled lifetimes, and register a handler
to serve the package documentation; and
2) to direct the client to open a browser page
showing the package documentation for the selection.
The server is a minimal imitation of pkg.go.dev,
working off the cache.Package representation. This means
we can display doc markup even for unsaved editor buffers,
and show type-derived information such as method sets
of each type.
Clicking through to the source--which on pkg.go.dev goes
to cs.opensource.google--causes the client editor to
navigate directly to the source file, using the magic
of showDocument requests.
The web server is secure in that all its endpoint URLs contain
an unguessable secret, so a local process belonging to
a different user can't access source code by port scanning.
The CL includes a test that
(a) the webserver content reflects edits (even unsaved)
in the source buffers, and
(b) that "clicking" through the source link causes
the server to navigate the client editor to the
correct source location.
A couple of tests that asserted "no code actions" needed
to be tweaked, as now there is always at least one
code action in any Go source file.
Change-Id: I2fe1f97e4e2b0b15cff6a4feb66501fce349b97d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/571215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
The runtime.GOROOT function is about to be marked as deprecated, which
will generate a diagnostic that isn't expected in format.txt test case.
Pick another hopefully somewhat future-proof identifier, since dealing
with this doesn't seem to be in scope of this test case.
For golang/go#51473.
Change-Id: I54d7ed0b43860bcd41938328211797a0cdd60e36
Reviewed-on: https://go-review.googlesource.com/c/tools/+/564275
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Rename methods on cache.Package to eliminate unnecessary "Get" prefixes.
Also rename pkg.go to package.go.
Change-Id: I42f2fa7a18a5973a53af93c63b48c7db19cba3b2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
The new method formats the graph in the syntax used by
the 'dot' command from https://graphviz.org/.
Fixesgolang/go#65754
Change-Id: Icf696419070e19b2f2236ac1e4aaa09323c565de
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572016
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
The current implementation doesn't assume any limit on the amount of
patterns passed to Load which breaks it when called on large codebases.
Different platforms have implemented different values for ARG_MAX,
https://www.in-ulm.de/~mascheck/various/argmax/#results,
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html,
https://devblogs.microsoft.com/oldnewthing/20031210-00/?p=41553.
In this fix, we use a conservative estimation of ARG_MAX (32767)
that would suit all the supported platforms, subtracted by an approx.
length of env on a typical machine (16384). We use this value to split
the provided patterns into chunks to run the underlying driver on chunks
instead of the whole patterns slice.
Fixesgolang/go#36909
Change-Id: I7c462c1e905b1f95013afa2b0ce2aa0a435125dc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/550477
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Starting soon, go/types will quote some user defined names in error
messages as `a'. Update tests to be tolerant of the new syntax.
Notably, logic in the unusedvariable analyzer which extracts the
variable name had to be updated.
Change-Id: I091ab2af9b5ed82aa7eacad8f4a9405f34fcded7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/571517
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
I clicked the wrong button (twice) before including
the last round of changes. This CL adds a necessary
copyright notice, and adjusts init() and comments in
a test file.
Change-Id: Ibf5d8e4d071fb571eab910902f0bc22009f2b81c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/571755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This CL introduces code to count how often proposed completions are accepted.
The results of the latest completion request are stored and compared
with the next DidChange notification. If the change is at the same
position, more than one character long, and matches a completion
item, the code counts the completion as accepted.
If, for some reason, DidChange returns multiple changes, only the
first is checked.
If the whole file is replaced there is no check for using any
proposed completion.
The test does not exercise the multi-change counter.
Change-Id: I08e9e39f651e4975a86c2dda9f6f5ceab7787e53
Reviewed-on: https://go-review.googlesource.com/c/tools/+/562248
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Now that go.dev/doc/telemetry exists, use it as a better link for
information about go telemetry.
For golang/go#63883
Change-Id: Ibe561c435e648b324a5ac444a8aade953354e92b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/570677
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Fix a crash found via telemetry, which may be encountered when finding
references for a package where one of the package files lacks a valid
name.
Fixesgolang/go#66250
Change-Id: Ifca9b6b7ab2ab8181b70e97d343fa2b072e866eb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/570676
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Fix a crash when Snapshot.fileOf fails, due to e.g. context
cancellation. The defer of release should only occur after the error is
checked. Unfortunately, this is very hard to test since it likely occurs
only due to races.
This is our first bug found completely via automated crash reporting.
Fixesgolang/go#66090
Change-Id: I7c22b5c2d1a0115718cd4bf2b84c31cc38a891ec
Reviewed-on: https://go-review.googlesource.com/c/tools/+/570675
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This change causes the stdversion checker not to report
any diagnostics in modules with go versons before go1.21,
because the semantics of the go declaration were not
clearly defined to correspond to toolchain requirements
at that point. Also, those Go versions are now unsupported,
so reporting diagnostics just creates unnecessary churn.
Updates golang/go#46136
Change-Id: I323f704c4d4f1f0fe5fc8b5680824bc07d3c4112
Reviewed-on: https://go-review.googlesource.com/c/tools/+/570140
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This change enables RunDespiteErrors, after auditing the code.
This should give more timely feedback while editing.
Also, it moves the vet/gopls common code (DisallowedSymbols)
to typesinternal.TooNewStdSymbols, out of the gopls module,
in anticipation of adding this analyzer to vet.
Updates golang/go#46136
Change-Id: I8d742bf543c9146376d43ae94f7adae3b453e471
Reviewed-on: https://go-review.googlesource.com/c/tools/+/570138
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This change is the counterpart to CL 569435 for completions
in imported packages.
Updates golang/go#46136
Change-Id: I57011897c395d37a89a8e3a99e8c3511de017ad3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/569796
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
RIP guru, Go's LSP server before LSP was invented.
Fixesgolang/go#65880
Change-Id: I75adef368e6e940c3b6dfc0ca06ad38ba0cf3656
Reviewed-on: https://go-review.googlesource.com/c/tools/+/569882
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
When a vendor directory is present, we must explicitly use -mod=readonly
to query upgrades with `go list`. This was broken by the fixes for
workspace vendoring, which removed the `-mod` flag in most usage of the
gocommand package.
Fixesgolang/go#66055
Change-Id: I29efb617a8fe56e9752dc088dc5ea884f1cefb86
Reviewed-on: https://go-review.googlesource.com/c/tools/+/569877
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This is the first step of deleting guru.
Updates golang/go#65880
Change-Id: Id33729265825f5557a47a5c571b2ae0e2d58336a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/570136
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This change fixes a gopls panic caused by giving go/types@go.1.20
a Go version string with three components, e.g. go1.2.3.
Unfortunately this is hard to write a test for, since it requires
building gopls with go1.20 and running it with a go1.21 toolchain.
Fixesgolang/go#66195
Change-Id: I09257e6ded69568812b367ee80cafea30add93d3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/570135
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
In golang/go#66145, users reported spurious import errors in multi-root
workspaces. The problem was related to scenarios where module A had a
local replace of module B, and the user opened a file F in module B that
wasn't in the forward dependencies of module A. In this case, if the
View of module A tried to load F, it would get real packages (not
command-line-arguments), but due to module graph pruning the View of
module A would not have access to the full set of dependencies for
module B, resulting in the potential for import errors. Even this would
not be a problem, as long as the package that module A loaded for F was
not considered a 'workspace' package.
Unfortunately a couple of incorrect heuristics in gopls added along with
the zero-config work of gopls@v0.15.0 allowed us to diagnose these
broken packages:
1. In resolveImportGraph, we called MetadataForFile for each overlay. As
a result, the import graph optimization caused gopls to attempt
loading packages for each open file, for each View. It was wrong for
an optimization to have this side effect.
2. In golang/go#65801, we observed that it was inconsistent to diagnose
changed packages independent of whether they're workspace packages.
To fix that, I made all open packages workspace packages. It was
probably wrong for the set of workspace packages to depend on open
files. To summarize a rather long philosophical digression: open
files should determine Views, not packages.
Fixing either one of these incorrect heuristics would have prevented
golang/go#66145. In this CL, we fix (2) by building the import graph
based on existing metadata, without triggering an additional load.
For (1), we check IsWorkspacePackage in diagnoseChangedFiles to enforce
consistency in the set of diagnosed packages. It would be nice to also
remove the heuristic that "all open packages are workspace packages",
but we can't do that yet as it would mean no diagnostics for files
outside the workspace, after e.g. jumping to definition. A TODO is left
to address this another day, when we can be less conservative.
Fixesgolang/go#66145
Change-Id: Ic4cf2bbbb515b6ea0df24b8e6e46c725b82b4779
Reviewed-on: https://go-review.googlesource.com/c/tools/+/569836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
When adding edges to the type graph for channel operations, we need the
*types.Chan object for the channel's type. The underlying type of a
channel may only be a type parameter, so use the core type instead to
get the *types.Chan.
Change-Id: I08078dbbb480363a372024161f0efb72a54c36a9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/568735
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This change causes the imports package to return not just
lists of symbol names, but stdlib.Symbol structures, and
causes gopls to use them to filter candidates based on
the Go version of the requesting file.
This filtering is not applied to imported completions,
or to methods of unimported types (which apparently
we don't complete at all, surprisingly). These are
left for follow-up changes.
Also, support negative assertions in completion
@rank markers.
Change-Id: I2ae62c2b83a366a37bdd8db88e28cca4c5f92ae5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/569435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Code comments contain many references to identifiers, highlighting these
references will make reading easier. Due to consistency and performance
considerations, only doc links are supported this time. Subsequent
changes will support hover and definition.
Updates golang/go#64648
Change-Id: I6b32075d703c03d06aaa16028cf55012d2e52c3c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/553836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This CL adds to gopls a new analyzer that reports references to
standard library symbols that are too new for the version of
Go in force in the referring file.
The test is duplicated within the gopls marker framework to
ensure we have coverage of per-file Go versions within gopls.
Updates golang/go#46136
Change-Id: Ic7e04e0ae75a586dc0ac5dfc86c6b4aa67d5d194
Reviewed-on: https://go-review.googlesource.com/c/tools/+/568237
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Use Func.Origin instead.
Change-Id: Ie4d29f2bd319a46901ce137107689e37d8e1edfa
Reviewed-on: https://go-review.googlesource.com/c/tools/+/569316
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Fix two bugs discovered during the investigation of golang/go#66109,
which revealed the strange and broken intermediate test variant form
"path/to/command/package [command-line-arguments.test]", referenced from
the equally broken
"command-line-arguments [command-line-arguments.test]". This latter
package was *also* detected as an ITV, which is why we never tried to
type check it in gopls@v0.14.2.
- Snapshot.orphanedFileDiagnostics was not pruning intermediate test
variants, causing it to be the one place where we were now type
checking ITVs.
- Fix the latent bug that caused gopls to record a dangling edge between
the two ITVs.
There is a third bug in go/packages, filed as golang/go#66126.
Fixesgolang/go#66109
Change-Id: Ie5795b6d5a4831bf2f73217c8eb22c6ba18e59cd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/569035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This CL extracts the std manifest from internal/imports,
and adds minor version and symbol kind information so that
tools such as goimports and the future API version checker
can give version-accurate results.
Updates golang/go#46136
Change-Id: I0785e5f06386f203f811742c477f9ced1c0d72b0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/567837
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Previously, if we saw an arg of interface type passed to a slog logging
function, we made no assumptions about it.
But we can do better when the argument is in key position:
- If neither string nor slog.Attr can implement the interface,
we can immediately report an error.
- If only slog.Attr can implement the interface, then we can
assume that the next position is a key and carry on.
Fixes#65740.
Change-Id: I1080c26b6cb46a46489f811e4cd73c9e505ce6b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/566895
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
A labeled statement with a blank label can't be the target of a goto,
break, or continue statement, so we don't need to create a new block for
it in builder.stmt.
Function.labelledBlock, which previously would be called to get a new
block, panics for blank labels anyway, because the type-checker doesn't
associate a blank label's *ast.Ident with a *types.Object.
Change-Id: I5f67214c0c35c6c2daf666dc2bd6d0169617e4ee
Reviewed-on: https://go-review.googlesource.com/c/tools/+/568675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
There are no major changes, but new are:
- ClientSignatureInformationOptions.NoActiveParameterSupport
- CodeActionClientCapabilities.DocumentationSupport
- type CodeActionDocumentation referred to in
- CodeActionOptions.Documentation
- Command.Tooltip (which might be useful)
- type LanguageKind string
- type RegularExpressionEngineKind = string
which is referred to in RegularExpressionClientCapabilities
- new CodeActionKind RefactorMove, and Notebook
The values of InlineCompletionTriggerKind have changed but the names did not.
And, the type TraceValues was renamed TraceValue.
Change-Id: I54d2ecb4a2a55cc24abc71f1f7b292f25bcac8d5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/568475
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This change adds a helper function to the template environment
to make it easier to compute the token.Position of an ssa Function.
Also, improve the documentation.
Fixesgolang/go#65980
Change-Id: I16d4cc87bb6f96985684da5ce027be296f22a601
Reviewed-on: https://go-review.googlesource.com/c/tools/+/567838
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
For Go >=1.22, FileVersions returns an unknown [invalid] Future version
when the file versions would be invalid. This better matches
go/types.
For Go <=1.21, FileVersions returns either the runtime.Version()
or the Future version.
Adds AtLeast and Before for doing comparisons with Future.
Updates golang/go#65612Fixesgolang/go#66007
Change-Id: I93ff1681b0f9117765614a20d82642749597307c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/567635
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This change is the result of an audit of all type assertions
and type switches whose operand is a types.Type. (These were
enumerated with an analyzer tool.)
If the operand is already the result of a call to Underlying
or Unalias, there is nothing to do, but in other cases,
explicit Unalias operations were added in order to preserve
the existing behavior when go/types starts creating explicit
Alias types.
This change does not address any desired behavior changes
required for the ideal handling of aliases; they will wait
for a followup. In a number of places I have added comments
matching "TODO.*alias".
It may be prudent to split this change by top-level directory,
both for ease of review, and of later bisection if needed.
During the audit, there appeared to be a recurring need
for the following operators:
- (*types.Func).Signature (golang/go#65772);
- Deref(Type): it's easy to forget to strip off the
Alias constructor;
- ReceiverName (CL 565075), for destructuring receiver
types such as T and *T, in which up to two Aliases
might be present.
Updates golang/go#65294
Change-Id: I5180b9bae1c9191807026b8e0dc6f15ed4953b9a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/565035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Change-Id: I78701b620029a94b47524f5d4a77c35a86df2e4e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/564337
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Add a test for the fix in golang/go#65952: a nil pointer exception when
highlighting a return value in a function returning no results.
Also, merge tests related to control flow highlighting, since it is
convenient to be able to run them together, and since there is
nontrivial overhead to tiny tests.
Updates golang/go#65952
Change-Id: Ibf8c7c6f0f4feed6dc7a283736bc038600a0bf04
Reviewed-on: https://go-review.googlesource.com/c/tools/+/567256
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
The format of the parse_test.go file was not consistent. This commit
fixes the format of the file.
Change-Id: I5ee8d5ae77b9830f58f15d83e724875367e894bd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/566376
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>