Граф коммитов

9015 Коммитов

Автор SHA1 Сообщение Дата
Rob Findley bd86f8c28a gopls/internal/cache/analysis: lazily resolve the import map
In CL 613715, we made import lookup lazy to mitigate the quadratic
construction of the import map during type checking. This CL makes the
equivalent change for the analysis driver.

Since analysis does not have fine-grained invalidation, it is even more
susceptible to the performance cost of this quadratic operation:

DiagnosePackageFiles-64
│  before.txt   │              after.txt              │
│    sec/op     │    sec/op     vs base               │
  1691.6m ± ∞ ¹   693.6m ± ∞ ¹  -59.00% (p=0.008 n=5)

│   before.txt   │               after.txt               │
│ cpu_seconds/op │ cpu_seconds/op  vs base               │
     6.480 ± ∞ ¹      3.260 ± ∞ ¹  -49.69% (p=0.008 n=5)

For golang/go#53275

Change-Id: I8690bc85848fe1e36391d4622aa2e3d3f9878f57
Reviewed-on: https://go-review.googlesource.com/c/tools/+/619095
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-10-09 17:58:41 +00:00
Tim King a4e0a9e3d7 cmd/bundle: enable materialized aliases
Change-Id: If402c12e2412890334c7188b6579964cb4b97454
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618676
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-10-09 17:01:35 +00:00
Rob Findley db26c69117 cmd/stringer: fix test on android
Fix a broken test build on android due to inconsistent build constraints
in test files.

Change-Id: I6350797fb65f2f2699e11b95b01a4aa3b3b84307
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618996
Run-TryBot: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-10-09 16:29:45 +00:00
Rob Findley f08b5c1e7c gopls/internal/test/integration/bench: add a pull diagnostics benchmark
Add a benchmark that exercises a currently slow operation using pull
diagnostics: requesting diagnostics for a large number of package files.

For golang/go#53275

Change-Id: I233cfaeb4242ab44a7b46c870a195fdf7793c05c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618995
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>
2024-10-09 15:28:35 +00:00
John Dethridge bbb979fff6 go/callgraph/vta: use node IDs for type flow graph
The vtaGraph type stores a directed graph, where the nodes are interface
values.

This change maps the nodes to unique integers internally and stores the
adjacency lists of the graph using the integers, which are smaller and
faster to work with.

This saves 40% time and peak memory usage when analyzing some very large
projects.

Change-Id: I45468ea9b478d2291f80140158cc8719e992b14e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614095
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
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>
2024-10-09 15:01:56 +00:00
Alan Donovan cf8979b7fc gopls/doc/features: add index of supported Code Actions
Also:
- add reminders to keep things in sync.
- use explicit anchors instead of relying on GitHub's
  unspecified algorithm (which doesn't work in mdweb preview).

Fixes golang/go#54115
Fixes golang/go#68791

Change-Id: I17c800075260e2e72dcd239fb7248a0cb3851d5d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618616
Auto-Submit: 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>
2024-10-08 22:13:03 +00:00
Tim King 86219190c2 go/ssa/ssautil: disable fmt imports on wasm tests
Fixes golang/go#69783

Change-Id: Iebdd90527de4efe8995d5b42d6e25089761135dc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618555
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
2024-10-08 17:49:19 +00:00
Peter Weinberger f439874c29 internal/modindex: add symbol information
This CL adds information about exported symbols to the module cache
index, together with a minimal test.

A future CL will add a Lookup function for finding completions for
selectors.

Change-Id: Ic36b5f30383187f9c5551ee2757258ed1445ea53
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616416
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-10-08 11:58:44 +00:00
Rob Findley f21a1dce1e gopls: add initial support for pull diagnostics
Implement the scaffolding for pull diagnostics. For now, these are only
supported for Go files, only return parse/type errors for the narrowest
package in the default view, do not report related diagnostics, and do
not run analysis. All of these limitations can be fixed, but this
implementation should be sufficient for some end-to-end testing.

Since the implementation is incomplete, guard the server capability
behind a new internal "pullDiagnostics" setting.

Wire in pull diagnostics to the marker tests: if the server supports it
("pullDiagnostics": true), use pull diagnostics rather than awaiting to
collect the marker test diagnostics.

For golang/go#53275

Change-Id: If6d1c0838d69e43f187863adeca6a3bd5d9bb45d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-10-07 22:08:29 +00:00
Rob Findley c19060b012 gopls/internal/cache: use packageHandles to hold an active package cache
Previously, gopls was keeping a common import graph up to date between
snapshots, to optimize re-typechecking open packages. However, this had
several downsides:
 - It required rather complicated accounting
 - Working in package A could get slower after opening package B, if
   package B was in the forward closure of A, since it reduced the
   common import graph.
 - Since imports were constructed a-priori to type checking, we imported
   *all* packages in the forward closure of open packages, even if they
   wouldn't be needed for type checking, inflating the memory footprint.

This CL changes gopls to instead keep track of the active package on the
packageHandle, and invalidate its imports independently of other active
packages. As a result, we can eliminate the complicated importGraph
logic and the associated relationships between open packages. We also
reduce memory by holding on to a minimal set of imports for open
packages.

Change-Id: I82c49bb7002ab748497f34b43844b34176bdef9c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614165
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-10-07 21:38:32 +00:00
Tim King a30b2075ca internal/versions: remove InitFileVersions
InitFileVersions is not longer conditionally needed at x/tools
supports Go >= 1.22.

Change-Id: I5df1b46463d23acda569e1378027d542ac749f93
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617637
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Tim King <taking@google.com>
2024-10-07 18:12:27 +00:00
Jack Baldry de11c555db gopls/doc/codelenses: fix link typo
Change-Id: I1105cec5cf851932a15410a674196e32c97ac832
GitHub-Last-Rev: a324267649
GitHub-Pull-Request: golang/tools#527
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617617
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-10-06 21:46:03 +00:00
Tim King 0b989c812d internal/versions: update test expectations
Updates test expecations now that go.dev/cl/607955 has been submitted.

Change-Id: I795a14f7690026620f270e2db329945286764046
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617635
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Tim King <taking@google.com>
2024-10-05 18:05:32 +00:00
Meng Zhuo 89a53114db go/analysis/passes/asmdecl: allow syscall write registers implicitly
Syscall will write register implicity, which asmdecl should allow
this writes.

Fixes golang/go#69352

Change-Id: I7e0dece5428e9ef359b89ce418adc533f7515b1b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611815
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-05 11:54:47 +00:00
Tim King f8f3c13ff3 internal/aliases: add a function to conditionally enable aliases
Conditionally enable the gotypesalias GODEBUG setting based on the
gotoolchain used to compile the tool.

Change-Id: I1e698249f943c8f2cb95c3acbc45aedf64260667
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617636
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Tim King <taking@google.com>
2024-10-04 19:46:29 +00:00
Gopher Robot 2ab3b51435 go.mod: update golang.org/x dependencies
Update golang.org/x dependencies to their latest tagged versions.

Change-Id: If6f30243f94e503d7457bc6f595e02366c5b7ec4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617660
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-04 17:29:21 +00:00
Alan Donovan 2683c792b4 gopls/internal/golang/stubmethods: rename analysis/stubmethods
Change-Id: I378afe9f961e6a6b3363f464cde198f2ca0bb525
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617255
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>
2024-10-04 15:35:56 +00:00
Alan Donovan efd951d807 gopls/internal/analysis/stubmethods: merge into CodeAction
This change removes the stubmethods analyzer, a roundabout
implementation, and instead computes it directly from the
protocol.QuickFix code action producer.

This is simpler, more efficient, and has noticeably lower
latency (being type-based not analysis based).
We should consider this for the other type-error analyzers.
However, the documentation, formerly generated to analyzers.md,
is now maintained in the Quick Fixes section of diagnostics.md.
More importantly, the `analyzers[stubmethods]` config setting
no longer exists.

Also:
- addEditAction et al: pass Diagnostics as a parameter
  instead of returning a pointer to a mutable CodeAction.
- protocol.Intersect: clarify how its treatment differs from
  mathematical convention in its handling of empty ranges,
  and fix a bug where by [1,2) and [2,3) were considered
  to intersect. (Only abutting empty ranges intersect by
  our definition.)
- Upgrade a marker test from @diag to @suggestedfixerr,
  now that the latter exists.

Change-Id: I010b2d4730596cac6f376c631839bfda159bf433
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617035
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>
2024-10-04 15:35:54 +00:00
Rob Findley d0d0d9ebc2 gopls/internal/cache: memoize dependent hash on analysisNode
Benchmarking demonstrated a nontrivial amount of time spent hashing
dependency information in the computation of analysisNode.cacheKey.
Memoize this hash to reduce cost.

Change-Id: Ic123202fbdf00c9de7b3f697c40f593ef798cd42
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-10-03 13:35:00 +00:00
Rob Findley a19eef6bcb gopls/internal/cache: express packageHandle as a state machine
In preparation for storing active packages on packageHandle, express the
various package handle states using a new packageState type, and hold on
to package handle data even if their local files may have changed, as
long as their metadata did not change.

Also: rename buildPackageHandle to evaluatePackageHandle, which better
matches its meaning, and move the package ID index to the View, since it
is shared across all snapshots.

Change-Id: I2c14613d320b1121f20bb3960d42370bef5ad98b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614164
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-10-03 13:22:18 +00:00
Robert Griesemer dd745ec14b gopls/internal/test/marker: update regression test issue68918.txt
The fix for golang/go#69092 produces an extra error message in Go 1.24.
Ignore it.

Updates golang/go#68918.
Updates golang/go#69092.

Change-Id: I41ecff6fe916a04ed943e29ad10184d340ef84d5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617475
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-02 18:38:44 +00:00
Tim King a02ee353de go/analysis/passes/stdversion: reenable tests
Enable units tests after 1.23. Tests were rewritten for the changes
to the 1.21 file version event horizon.

The test is not enabled for 1.22. A backport for golang/go#68658 may be required.

For golang/go#68658

Change-Id: I15f46e3ff3de7c02592d5a357ae199116323c29f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615685
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-02 17:41:11 +00:00
Tim King a24facf9e5 all: set gotypesalias=0 explicitly
Set GODEBUG variable gotypesalias to off in all main packages
in x/tools that use go/types.

This is a no-op as the x/tools go.mod is uses version 1.22,
which disables gotypesalias in main packages and tests by default.

Change-Id: I1593cd63ec018e230e126d990530bd59fb9a96cf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617095
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Tim King <taking@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-10-02 16:33:07 +00:00
Chiawen Chen ce2a33e35d gopls/internal: fix extract refactor for cases with anonymous functions
This fix ignores return statements inside anonymous functions. These
return statements can be ignored because they does not meddle with
the control flow of the outer function.

Fixes golang/go#64821

Change-Id: I21f82f8663bf3343412d5b537802a56efc34495f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617335
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
2024-10-02 15:18:27 +00:00
Tim King a2ff832d75 go/ssa: remove references to GOEXPERIMENT range
Range over int is in all supported Go versions for x/tools.

Change-Id: I16d3da47121fcf34251fa5cad9561848ef699a56
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616977
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-10-01 21:46:29 +00:00
Alan Donovan a7552bcbbe go/ast/inspector: add PreorderSeq and All iterators
This CL adds two functions that return go1.23 iterators
over selected nodes:
- inspect.PreorderSeq(types...), which is like Preorder but
  honors the break statement;
- All[N](inspect), which iterates over nodes of a single
  type, determined by the type parameter.

+ Tests, benchmark.

Fixes golang/go#67795

Change-Id: I77817f2e595846cf3ce29dc347ae895e927fc805
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616218
Auto-Submit: Alan Donovan <adonovan@google.com>
Commit-Queue: 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>
2024-10-01 19:29:00 +00:00
Alan Donovan d2e46216ad gopls/internal/server: CodeAction: interpret Only=[] as [QuickFix]
This CL changes the interpretation of an empty list of
CodeActionKind. Previously, we have always used it to mean
"all kinds"; however, the new guidance in the LSP 3.18 spec
is that servers should treat it equivalent to [QuickFix].

Following the spec exactly would reduce the frequency of
distracting lightbulbs displayed by VS Code's ⌘-. menu
for actions that are not fixes (e.g. Inline call to f).
But it would deny most clients (VS Code, Emacs, Vim, ...) the
natural way to ask the server what code actions are
currently available, making it impossible to discover
any code action (e.g. Browse gopls docs) that doesn't
fit into one of the existing categories with its own
command (e.g. Refactor, Source Action).

So, we compromise: if the CodeAction query was triggered
by cursor motion (Automatic), we treat [] as [QuickFix].
But if it was explicitly Invoked, we respond with all
available actions, equivalent to [""].

This does unfortunately double the test space; all but
one of our tests (TestVSCodeIssue65167)use TriggerKindUnknown.

Details:
- Adjust hierarchical matching to permit kind="" (protocol.Empty)
  to match all kinds.
- Change CLI and fake.Editor clients to populate
   Capabilities.TextDocument.CodeAction.CodeActionLiteralSupport.\
     CodeActionKind.ValueSet (!!), a 3.18 feature.
   (This isn't really needed now that the latest draft
   returns all available actions when trigger=automatic.)
- The @codeaction marker passes kind="".
- 'gopls codeaction' now passes Only=[""] when no -kind flag is specified.
- 'gopls imports' now passes Only=[SourceOrganizeImports]
   instead of obsolete title filtering.
- Editor.{serverCapabilities,semTokOpts} are no longer
  unnecessarily guarded by the mutex.
  (In an earlier draft I needed to expose Editor.ServerCapabilities
  but it proved unnecessary.)

Fixes golang/go#68783

Change-Id: Ia4246c47b54b59f6f03eada3e916428de50c42f4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616837
Commit-Queue: Alan Donovan <adonovan@google.com>
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>
2024-10-01 18:55:11 +00:00
Viktor Blomqvist 4e80b325ef cmd/stringer: support types declared in test files
Adds additional passes over the test variants of the given
package.  Picks the most "narrow" (least amount of files)
package where each type can be found. The generated code
will be placed in the same package and test-or-not-test file
as the original type declaration.

Closes golang/go#66557.

Change-Id: I2354cd44e357a9ce0b45f5e2fadc1c141455a88d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/604535
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-10-01 18:18:17 +00:00
Chiawen Chen 60b6bcdd60 gopls/rename: include filename in error message
Error messages now display the filename along with the package name
when a rename is blocked.

Fixes golang/go#69563

Change-Id: I00277281a78134271f7a0a7e8497a5863e48b92d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615686
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
2024-10-01 18:16:18 +00:00
Tim King 2848ab8d89 internal/gcimporter: clean up test expectations
Use (types.Object).String() to write expectations now that the
formatting for type parameterized aliases was fixed.

This resolves a TODO in TestIExportDataTypeParameterizedAliases.

Change-Id: I5b5d55cb7c190686c89dec59bdad30d83de595a5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616995
Auto-Submit: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-09-30 20:31:21 +00:00
Tim King ee66134971 go/ssa/ssautil: isolate deprecated CreateProgram
Isolate CreateProgram and its test into their own files
to further emphasize that these are deprecated.

Change-Id: I441a456752cc3d1728ab86c98e785c59696980f2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616976
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
2024-09-30 20:21:50 +00:00
Tim King 6ded0c4495 internal/gcexporter: cleanup test skipping in TestImportTypeparamTests
Cleaning up the documentation for skipping tests in 1.22 when gotypesalias=1.

Change-Id: Iaf387ff83d2d771d3a0196d6ca26aa49516799dd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615699
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Tim King <taking@google.com>
2024-09-30 18:23:58 +00:00
Muir Manders 66afc1a4e7 gopls/completion: tweak fuzz handling to make its own MethodSet
I'm going to try changing methodsAndFields() to not use
types.MethodSet anymore. The `*testing.F` handling depends on the
MethodSet, so let's change it to make its own.

Change-Id: Iba81a58eb66142ede87f2be9125ae08753fb1700
Reviewed-on: https://go-review.googlesource.com/c/tools/+/594235
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Muir Manders <muir@mnd.rs>
2024-09-27 22:10:22 +00:00
xieyuschen 7d92dd6f9b go/ssa/ssautil: use go/packages to load packages in switch_test.go
Updates golang/go#69556

Change-Id: I5459a835b96f6f79d193538fdbc85a3e1c7324cc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-27 21:39:05 +00:00
Rob Findley 18bc03245e gopls: update x/telemetry to pick up fix for golang/go#69681
Update the x/telemetry dependency to pick up the fix for crash reporting
from golang/go#69681.

For golang/go#69681

Change-Id: Ic8bda6e1e80a5004989567a5e7645ef99cf9130f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616415
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>
2024-09-27 19:09:55 +00:00
Tim King 6c47868975 internal/gcimporter: run larger tests with and without aliases
Run larger and standard library tests both with and without the
gotypesaliases GODEBUG enabled. Skips two know failures on 1.22.

Fixes an incorrectly copied constant in an expectation.

Change-Id: I8054bf5609b7a0e6fb544bd906a00f2f02f75b31
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616157
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Commit-Queue: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-27 19:01:38 +00:00
Alan Donovan c6f2f8edba refactor/eg: rewrite test without go/loader
Now, each template, its inputs and outputs are all
packages within a single .txtar archive.

Updates golang/go#69556

Change-Id: I95285487597df985a16879ea1f5cb6a75c77fa12
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-27 18:47:40 +00:00
Tim King 8b6849d85a go/ssa/interp: reenable lifetime tests.
For golang/go#68658

Change-Id: I6e05e21f924cda18e368543e59071b2c79c16ef2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615698
Commit-Queue: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-27 17:50:37 +00:00
Rob Findley edfeacf5cb internal/golang: fix panic in signatureHelp over builtin name
CL 605983 made it such that signatureHelp succeeds over the function
name of a call expression, but the builtin codepath did not handle a nil
CallExpr. Fix this, with a test. Also improve the @signature marker
errors.

Fixes golang/go#69552

Change-Id: I818c7cbdb1a8c768466f0dcbaddbc8a45a681add
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616216
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
2024-09-27 14:58:56 +00:00
Tim King ab64376303 go/types/objectpath: skip package tests with wasip1
Use testfiles.LoadPackages to load the packages.

Change-Id: Id740fb03440fce079c63bed00b33da15770f133b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616158
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
2024-09-27 14:44:39 +00:00
Tim King e55961d46c internal/gcimporter: use types.NewInterfaceType
Use types.NewInterfaceType directly. This has been available since Go 1.11.

Change-Id: I3669ce485bc99a758530158db02a470d81ad7b85
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615697
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Tim King <taking@google.com>
2024-09-26 21:58:18 +00:00
Tim King c59bc300b2 internal/gcimporter: vary the value of any in predeclared
Vary the types in predeclared() based on the runtime value of any
in types.Universe (either universeAnyNoAlias or universeAnyAlias).

Change-Id: Iacf43d21c7d078706ac20ded7ffdeadffbb4baf5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615683
Commit-Queue: Tim King <taking@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-26 21:56:35 +00:00
Tim King 4fc0d79003 internal/gcimporter: remove goexperiment.unified tags
goexperiment.unified was removed in 1.21.

Change-Id: I388d657da578f33616c45b8a18a2266443956757
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Tim King <taking@google.com>
2024-09-26 20:52:18 +00:00
Alan Donovan f05b5f456f go/packages: document the role of PWD
Fixes golang/go#67757

Change-Id: I783fa88cfcfb77fdadc02a303cbaec4910f8b8fc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616057
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Alan Donovan <adonovan@google.com>
2024-09-26 18:34:21 +00:00
xieyuschen 3483a5ef40 go/packages: use link notation in comments for godoc rendering
fixes golang/go#69618

Change-Id: I7585b7cf92472b4ff1944ad3486cd930475143d1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615695
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2024-09-26 18:32:02 +00:00
Tim King 75350b9b99 go/ssa: remove import of loader from builder_test.go
Unused import of loader in builder_test.go.

Change-Id: I518f7f1d866064bbb89d4690e9c5c182f80d1a47
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616175
Auto-Submit: Tim King <taking@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-09-26 18:31:01 +00:00
Tim King 1c9ca8b8ba go/types/objectpath,internal/aliases: miscellaneous clean up of tests that set gotypesalias
* Fix default value test ("") for TestNewAlias.
* Updates references to 1.19 to 1.22.

Change-Id: I9c19621e820c90c265235afff863863d03f2d171
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615696
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-09-26 17:11:08 +00:00
xieyuschen 23e1af6910 go/ssa: migrate TestGenericFunctionSelector away from loader
Use qualified identifier to check instantiated function.

Updates golang/go#69556

Change-Id: I857de1b3d13d052dc09d96454715f8128237362e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614995
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>
Reviewed-by: Tim King <taking@google.com>
2024-09-26 17:07:54 +00:00
xieyuschen 8adb6e83db go/ssa: migrate TestTypeparamTest away from loader
Updates golang/go#69556

Change-Id: I5683a0139595c5b505e25cdccba3dad422cc6d69
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614975
Reviewed-by: 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>
Auto-Submit: Alan Donovan <adonovan@google.com>
2024-09-26 16:52:40 +00:00
Rob Findley 7bb384dcf8 gopls/internal/test/integration/bench: add an IWL test that opens files
The existing BenchmarkInitialWorkspaceLoad does not open files, which
means it measures only the speed of loading and verifying the workspace
state, with hot caches. It does not measure the memory or time consumed
when starting to actually work on a file.

Fix this by opening a file.

Also, add -profile.block to gopls and -gopls_blockprofile to gopls
benchmarks, for better diagnosis of contention.

Change-Id: I63ef7c9a26ca71ddd9b6895369921655eaa4f090
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614163
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-09-26 14:44:37 +00:00