Skip the obj importer test when running on AIX. For this test to
work properly on AIX, we need to port CL 152720 (or something like
it) here from the main repo.
Updtes golang/go/#49445.
Updates golang/go#29113.
Change-Id: If75a452950a5dcad4afa18d973f3c94b6065f724
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362434
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Skip the installation test when running on AIX. For this test to
work properly on AIX, we need to port CL 152720 (or something like
it) here from the main repo.
Fixes golang/go/#49445.
Updates golang/go#29113.
Change-Id: Idf1f9d717aa835b80cffa4e3ab34ae578a809860
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362248
gopls-CI: kokoro <noreply+kokoro@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Change the TestInstallationImporter testpoint to query type
information for sort.Search instead of sort.Ints. The latter function
changed recently (1.16 timeframe), parameter "a" is now "x". A better
candidate for this sort of query is sort.Search, which has been stable
or a while.
This is a copy of CL 294290 from the main repo.
Updates golang/go#44425.
Change-Id: Ibc79602cafc46c20be4b085f9a92977b06f9d658
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362247
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Use t.TempDir() instead of os.MkdirTemp().
This is a copy of CL 309356 from the main repo.
Updates golang/go#45402.
Change-Id: Ia555a701e4de568871a765ee551e65a5c998cde9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362246
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Avoid problems with distro scanning by not using files that look like
object files.
This is a copy of CL 352450 from the main repo.
Updates golang/go#48548.
Change-Id: I519d0aa73fa46470d1a41ce29a1da046a9f57f3b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362245
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
In a couple of places the documentation had the wrong names for
examples.
Change-Id: If321643d2bc22e2d1bd27203f0e8dbf3ef66beba
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362154
Trust: Peter Weinberger <pjw@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Also eliminate a goroutine leak in case of connection timeout.
Change-Id: I82c1a8352658353ef5d0ba4e7ce9e617ce7b42a3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/236750
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Add test cases to verify that generic functions and methods are detected
as printf wrappers.
Change-Id: I110a415673976d01b5baae6e2a82d296c2f7d2bf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360155
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
parameter’s type set
Pending the acceptance of golang/go#49038, this CL updates the printf
analyzer to warn if any elements of a type parameter's type set do not
match the printf verb being considered. Since this may be a source of
confusion, it also refactors slightly to allow providing a reason why a
match failed.
Updates golang/go#48704
Updates golang/go#49038
Change-Id: I92d4d58dd0e9218ae9d522bf2a2999f4c6f9fd84
Reviewed-on: https://go-review.googlesource.com/c/tools/+/351832
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tim King <taking@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Updates importMap() to consider generics.
For golang/go#48704
Change-Id: Ic5dafc644c4e81a64df338a165ee8e20627c6113
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360295
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Tim King <taking@google.com>
We should not infinitely expand type parameters looking for a lock path.
Fixesgolang/go#49384
Change-Id: I8e1c952d468908aeb16751dddd6c05bb07f3c95c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361456
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
typeutil.StaticCallee now supports generic functions, so that can be
used instead of ctrlflow computing static callee for generics on its own.
Change-Id: I38aaf2d91bf1b7f4d0bf5ba6a6684271c1569464
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361406
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
The zero value of token.Pos is special: it determines IsValid(), which
has semantic significance in many places.
offsetPositions, which adjusts positions after AST mangling, was
adjusting all positions -- including invalid positions. As a result it
was making invalid positions valid, leaving a nonsensical AST.
Fix it to skip invalid positions.
Change-Id: I844f243f9a4a3f98ace32fe30e934410d11142dd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361614
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
Tries will be used to implement type sets in the following CLs. The main
purpose of this is to reduce memory consumed by VTA.
Change-Id: I7b5b6778cea254a6c053bd7b995e5ca5830c073f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360776
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
Run-TryBot: Guodong Li <guodongli@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Guodong Li <guodongli@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
The existing implementation does not identify lock copies when doing
multi-assignment, i.e. foo, ok := someMap["key"]
Currently, it will find issue with similar code foo := someMap["key"].
This discrepency is because a return type of Tuple was not considered
when resolving the type of the right hand side of the assignment.
Fixes#45896
Change-Id: I93266dbd03a301ff558d826ff4fe70fc0344cb77
GitHub-Last-Rev: bb51bdd664b060e481ce0091701ed3470558cf0f
GitHub-Pull-Request: golang/tools#319
Reviewed-on: https://go-review.googlesource.com/c/tools/+/323589
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
Trust: Robert Findley <rfindley@google.com>
While type parameter type strings are being adjusted, comment out some
tests that will cause trybots to fail.
Change-Id: Ia04c151654a8ae6c3a475a464d8c4b5f4dadc7a0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360916
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
It does not appear to be needed any more.
For golang/go#38415
Change-Id: I5c9525a96606df93c58cc15a4cb4281f95b93902
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360915
Trust: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
x/tools/go/loader by default prints errors to stderr.
TestBExportData_stdlib and TestIExportData_stdlib intentionally load
packages with errors, resulting in spurious (and confusing) output
from passing tests when the test binary fails for other reasons.
Suppress these spurious errors by setting each tests's types.Config to
print errors to the test log instead.
For golang/go#38415
Change-Id: I93fee06c4141bb4c15bd285844668df6eec44892
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360914
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
These testcases use in excess of 1GiB RAM.
Fixesgolang/go#33959
Change-Id: I08e1b8cb8215d23d753a69749306e9753fc4c35e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/193181
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Trust: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This test was already memory-hungry to begin with, and apparently the
switch to go/packages in CL 356513 pushed it over the edge of the
32-bit address space (at least with the default GOGC setting). Rather
than trying to precisely tune it to skim under the 32-bit limit,
let's just skip the test on platforms with insufficient address space.
Updates golang/go#14113
Updates golang/go#48547
Change-Id: Iab99e9ce70a98034194d7c7ad7df7a545ac95ef3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360837
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Do a pass a cleaning up the matchArgType and matchArgTypeInternal
functions:
- Remove the 'typ' argument from matchArgType, since external callers
must pass nil. It must have predated matchArgTypeInternal.
- Remove the `if false` blocks that were placeholders for the *verbose
flag. It has been three years, so seems safe to delete this dead
code. This also means we don't do any reporting via matchArgType,
which is cleaner.
- Extract the types.Info lookup of the arg type into matchArgType; it
doesn't make sense in recursive calls to matchArgType.
- Compare against types.Typ[types.Invalid] directly, rather than
comparing against the type string "invalid type".
- Remove an unused pass argument from isConvertibleToString.
- Remove the now unused 'pass' and 'arg' arguments from
matchArgTypeInternal.
Change-Id: I52232a881090e40943e4c4c377ae8436512232b1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360154
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
With CL 360758, this will be a type-checker error.
Change-Id: Ic37c4bc671b707751fe22100bb525c91b5d5a5f2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360834
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Add support for finding incorrect usage of locks via type parameters. It
would probably be fine not to do this, since using locks explicitly via
type parameters should be exceedingly rare. However, it was
straightforward to add, and is consistent with other analyzers.
Updates golang/go#48704
Change-Id: I329a2fa9f11c6bbb491d49afde7fabce8299cbdf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360234
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
Adds support for finding the Callee if it is a generic function.
Generic methods happen to already work without this change.
Updating this so that they are consistent.
For golang/go#48704
Change-Id: I649ec746e350db4a0086ed31535b2e14baa32314
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359974
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
For CL 359656
For golang/go#49213
Change-Id: Ib2c5d8fa60702baf07530226322a0a113af6b9e8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360335
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
For CL 359656
For golang/go#49213
Change-Id: I3ae7abe8acc0d8816e2029aa55e8bbaee1e05c94
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360334
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Check for potentially invalid string int conversions via type
parameters.
Updates golang/go#48704
Change-Id: I0269857f3245909cf60c78c6dd624c1c0090c22d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359294
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
Apply Options.DirectoryFilters when searching for workspace symbols.
The natural way to implement it would lead to an import loop, so
the working code was moved from cache to source.
Fixesgolang/go#48939
Change-Id: Iccf32bc8327ba7845505a6a3de621db8946063f5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359514
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Peter Weinberger <pjw@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
testdata/src/typeparams is similar to testdata/src/a but
uses type parameters.
For golang/go#48704
Change-Id: I2d49190b606d6cdcfe79af5f29bba1117b07b94a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359894
Run-TryBot: Guodong Li <guodongli@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Guodong Li <guodongli@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Warn about Test functions that contain type parameters.
For golang/go#48704
Change-Id: I3f6852613482ec6f33e5650a014564915f11b920
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359494
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Tim King <taking@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Update the testinggoroutine analyzer to find bad calls via instantiated
function calls.
For golang/go#48704
Change-Id: I39ef43090a0e5dd04dfe094376517ac25441ad27
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359401
Trust: Robert Findley <rfindley@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Ensure that the logic for detecting incorrect signatures of standard
methods applies to methods on generic types.
For golang/go#48704
Change-Id: I1862238ad1ff013137b12674fbc0068a7e8a3c60
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359409
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
This CL adds a test for unused results inside a function using generics.
Update golang/go#48704
Change-Id: I3703cd6bbc40142b4a667d3cd069ea0721a045ec
GitHub-Last-Rev: 1c6db19cf61e9ac444305e9155c19ff0db8927f4
GitHub-Pull-Request: golang/tools#345
Reviewed-on: https://go-review.googlesource.com/c/tools/+/357411
Reviewed-by: Tim King <taking@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
This CL adds a test for the assign pass that involves use of generics.
Updates golang/go#48704
Change-Id: I19d27932f0d326e2456b6714f76de01d46f1b1e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/357777
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Add missing functions using empty interface in `sort` package.
Change-Id: Ic39bc55897705b08d3739a993b30d4b4e9a77baf
GitHub-Last-Rev: 1cfb9149456ebe6489299564e53666cdafcf49de
GitHub-Pull-Request: golang/tools#318
Reviewed-on: https://go-review.googlesource.com/c/tools/+/319689
Reviewed-by: Tim King <taking@google.com>
Trust: Tim King <taking@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Per the issue below, a lone type parameter is not permitted
on the the RHS of a type declaration, at least for Go 1.18.
Slightly modified the generics tests so that they pass for
now.
For golang/go#45639.
Change-Id: I3c5dc0ff65bfdc268c372e5e3fdfe00a8547f17e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359274
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
assertions
Change-Id: I5e47a3070c2c91f18134980a3bcd32964f1df1a3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/358616
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
Warn about shifts that exceed the width of a type in the type parameter
type set.
For golang/go#48704
Change-Id: If16650b0c7214415f650884014eda9690d8da11a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/357758
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>