Currently, during walk we rewrite PAUTOHEAP uses into derefs of their
corresponding Heapaddr, but we can easily do this instead during SSA
construction. This does involve updating two test cases:
* nilptr3.go
This file had a test that we emit a "removed nil check" diagnostic for
the implicit dereference from accessing a PAUTOHEAP variable. This CL
removes this diagnostic, since it's not really useful to end users:
from the user's point of view, there's no pointer anyway, so they
needn't care about whether we check for nil or not. That's a purely
internal detail. And with the PAUTOHEAP dereference handled during SSA
construction, we can more robustly ensure this happens, rather than
relying on setting a flag in walk and hoping that SSA sees it.
* issue20780.go
Previously, when PAUTOHEAPs were dereferenced during walk, it had a
consequence that when they're passed as a function call argument, they
would first get copied to the stack before being copied to their
actual destination. Moving the dereferencing to SSA had a side-effect
of eliminating this unnecessary temporary, and copying directly to the
destination parameter.
The test is updated to instead call "g(h(), h())" where h() returns a
large value, as the first result will always need to be spilled
somewhere will calling the second function. Maybe eventually we're
smart enough to realize it can be spilled to the heap, but we don't do
that today.
Because I'm concerned that the direct copy-to-parameter optimization
could interfere with race-detector instrumentation (e.g., maybe the
copies were previously necessary to ensure they're not clobbered by
inserted raceread calls?), I've also added issue20780b.go to exercise
this in a few different ways.
Change-Id: I720598cb32b17518bc10a03e555620c0f25fd28d
Reviewed-on: https://go-review.googlesource.com/c/go/+/281293
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
With the recent compiler rewrites and cleanups to gc/fmt.go, the
"safety net" provided by fmt_test has become less important and
the test itself has become a burden (often breaks because of small
format changes elsewhere).
Eventually, the syntax and types2 packages will provide most error
and diagnostic compiler output at which point fmt.go can be further
simplified as well.
Change-Id: Ie93eefd3e1166f3548fed0199b732dbd6c81948a
Reviewed-on: https://go-review.googlesource.com/c/go/+/282560
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Follow-up on feedback by mdempsky@ in https://golang.org/cl/282552 .
Change-Id: I1e5bb2d67cc8ae29fed100b87d18a33b3e2069eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/282672
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Module-related help pages now contain a brief summary and point to the
reference documentation at golang.org/ref/mod for details.
Help pages for commands like 'go get' still describe the basic usage
and summarize flags but don't provide as much background detail.
Fixes#41427Fixes#43419
Change-Id: Icacd38e0f33c352c447cc5a496c99674493abde2
Reviewed-on: https://go-review.googlesource.com/c/go/+/282615
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
* All commands the user can run to fix the problem now appear alone on
a separate line after a tab.
* Removed -d from 'go get' commands.
* Replaced 'go mod tidy' with 'go mod download $modpath' when a
package might be provided by a module missing a sum.
* Errors about 'path@version' syntax are more explicit.
Fixes#29415Fixes#42087Fixes#43430Fixes#43523
Change-Id: I4427c2c4506a727a2c727d652fd2d506bb134d3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/282121
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Previously, commands that wrote go.sum (except 'go mod tidy') would
retain sums for zip files of directly required modules. Sums of
indirect dependencies wouldn't be retained unless they were used to
load packages.
With this change, sums for indirect dependencies will be retained if
they're available. This allows users to add missing sums with
'go mod download example.com/mod', which previously only worked for
directly required modules.
Note that 'go mod download' without arguments now adds sums for every
module in the build list. That matches 1.15 behavior.
For #41103
Change-Id: I4cce2bf1c73578dae836bdb5adb32da071554f1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/282692
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
All the current histogram metrics accumulate counts from program start
to infinity, and can be reasonably used to compute rates (also to
generate windowed distributions).
Change-Id: I5196c59867de34fba41bb8552606fa315460cef9
Reviewed-on: https://go-review.googlesource.com/c/go/+/282633
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
This change removes the as-of-yet unused StopTheWorld field in the
Description struct. Adding a new field to a struct is much easier than
removing it, so let's save it for when we actually need it.
Change-Id: I8074b8569187c1a148500575fa8a661534e875d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/282632
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
This moves the Walk visitor from the types2 to the syntax
package. There are no changes but for package name adjustments.
Preparation for a more full-fledged node visitor.
Change-Id: I95217e27ff943ac58a7638fb8d1cd347d0d554b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/282556
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This CL moves the exprstring_test.go from the types2
package into the syntax package (which contains the
actual ShortString function). The code is mostly un-
changed but for the updated TestShortString function.
Change-Id: Ib39e3181e643fc0ac96ddf144a3114893a50c2fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/282554
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
The syntax package has a full-fledged node printer. Use that printer
to create the expression strings needed in error messages, and remove
the local (essentially) duplicate code for creating expression strings.
Change-Id: I03673e5e79b3c1470f8073ebbe840a90fd9053ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/282553
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Preparation for using the syntax printer as expression printer in types2.
- Introduced Form to control printing format
- Cleaned up/added String and ShortString convenience functions
- Implemented ShortForm format which prints … for non-empty
function and composite literal bodies
- Added test to check write error handling
Change-Id: Ie86e46d766fb60fcf07ef643c7788b2ef440ffa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/282552
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
I have a real 7,000-line Go program (not so big)
that took over two minutes to report a trivial init cycle.
I thought the compiler was in an infinite loop but
it was actually just very slow.
CL 170062 rewrote init cycle reporting but replaced
a linear-time algorithm with an exponential one:
it explores all paths through the call graph of functions
involved in the cycle.
The net effect was that Go 1.12 took 0.25 seconds to load,
typecheck, and then diagnose the cycle in my program,
while Go 1.13 takes 600X longer.
This CL makes the new reporting code run in linear time,
restoring the speed of Go 1.12 but preserving the semantic
fixes from CL 170062.
Change-Id: I7d6dc95676d577d9b96f5953b516a64db93249bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/282314
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
When running go tool compile,
go tool is running compile as a subprocess.
Killing go tool with Process.Kill leaves the subprocess behind.
Send an interrupt signal first, which it can forward on
to the compile subprocess.
Also report the timeout in errorcheck -t.
Change-Id: I7ae0029bbe543ed7e60e0fea790dd0739d10bcaa
Reviewed-on: https://go-review.googlesource.com/c/go/+/282313
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This way, if a SIGINT is sent to the go command,
it is forwarded on to the underlying tool.
Otherwise trying to use os.Process.Signal to kill
"go tool compile" only kills the "go tool" not the "compile".
Change-Id: Iac7cd4f06096469f5e76164df813a379c0da3822
Reviewed-on: https://go-review.googlesource.com/c/go/+/282312
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This package implements a parser for the new //go:build constraint lines.
The parser also handles // +build lines, to be able to process legacy files.
This will not be used in the standard library until Go 1.17,
but it seems worth publishing in Go 1.16 so that code that
needs to process both kinds of lines once Go 1.17 comes out
will be able to build using Go 1.16 as well.
For #41184. Design in https://golang.org/design/draft-gobuild.
Change-Id: I756c0de4081c5039e8b7397200e5274f223ab111
Reviewed-on: https://go-review.googlesource.com/c/go/+/240604
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Russ Cox <rsc@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
The testing.TestFS function assumes that the file system it's testing
doesn't change under it. Clarify this in the documentation and fix the
use of os.TestDirFS that's currently susceptible to this race.
Fixes#42637.
Change-Id: Ia7792380726177f8953d150ee87381b66cb01cb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/282452
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This change modifies the *-by-size metrics' units to be based off the
bucket's unit (bytes) as opposed to the unit of the counts (objects).
This convention is more in-line with distributions in other metrics
systems.
Change-Id: Id3b68a09f52f0e1ff9f4346f613ae1cbd9f52f73
Reviewed-on: https://go-review.googlesource.com/c/go/+/282352
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
The documentation for Glob was copied from filepath.Glob, and needs a bit
of tweaking: paths are not rooted at slash; the separator is always '/'.
Fixes#43537
Change-Id: Id64daa137e2762b66a82a5b9e60bbe603f4e2f5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/282173
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Current optimization: When we copy a->b and then b->c, we might as well
copy a->c instead of b->c (then b might be dead and go away).
*Except* if a is a volatile location (might be clobbered by a call).
In that case, we really do want to copy a immediately, because there
might be a call before we can do the a->c copy.
User calls can't happen in between, because the rule matches up the
memory states. But calls inserted for memory barriers, particularly
runtime.typedmemmove, can.
(I guess we could introduce a register-calling-convention version
of runtime.typedmemmove, but that seems a bigger change than this one.)
Fixes#43570
Change-Id: Ifa518bb1a6f3a8dd46c352d4fd54ea9713b3eb1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/282492
Trust: Keith Randall <khr@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This change modifies the semantics of
runtime/metrics.Float64Histogram.Buckets to remove implicit buckets to
that extend to positive and negative infinity and instead defines all
bucket boundaries as explicitly listed.
Bucket boundaries remain the same as before except
/gc/heap/allocs-by-size:objects and /gc/heap/frees-by-size:objects no
longer have a bucket that extends to negative infinity.
This change simplifies the Float64Histogram API, making it both easier
to understand and easier to use.
Also, add a test for allocs-by-size and frees-by-size that checks them
against MemStats.
Fixes#43443.
Change-Id: I5620f15bd084562dadf288f733c4a8cace21910c
Reviewed-on: https://go-review.googlesource.com/c/go/+/281238
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
The findEmbed function looking for comment by readbyte,
however it might have constant or variables that contains
comment.
Maybe we should use ast parser in the future.
Fixes#43373
Change-Id: I92544384fc4c11363d8b2f6b9898c8dea1602767
Reviewed-on: https://go-review.googlesource.com/c/go/+/280332
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Change-Id: Ifcc565b34b3c3bb7ee62bb0525648a5d2895bf0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/282013
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
For #41127
Change-Id: I794a082299c6dce4202223197ece1864bed36810
Reviewed-on: https://go-review.googlesource.com/c/go/+/282555
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
io/fs is introduced in 2020, not 2009 nor 2010
Change-Id: I7d63aae17b1f8c3af1ded2f639e3fb76ff2aea81
Reviewed-on: https://go-review.googlesource.com/c/go/+/282232
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
In particular bring in CL 201973, which reverts support for multiple
keys in a struct tag.
For #40281
For #43083
For #43226
Change-Id: I66e76639cbbca55bdbff6956acdb0a97650fdd31
Reviewed-on: https://go-review.googlesource.com/c/go/+/282412
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Proposal #40281 was initially accepted, but has now been declined.
This CL removes most of the work done to implement it.
Specifically this reverts CLs 248341, 274448, 274474, and 278392.
For #40281
For #43226
Change-Id: I5a9ebb4d9cb5fb0962434b64c59beb8343030be5
Reviewed-on: https://go-review.googlesource.com/c/go/+/281515
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
The documentation was copied from filepath.WalkFunc, and the copy was
not fully adjusted to the new circumstances.
Fixes#43536
Change-Id: I09687c7656e6938ebd9fc1e1643d34be88cf141d
Reviewed-on: https://go-review.googlesource.com/c/go/+/282172
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Marco Gazerro <gazerro@open2b.com>
golang.org/cl/251878 disallowed non-ASCII characters in import paths,
in module mode. They were already disallowed in module paths, so this
change just extended the restriction to the package subdirectory of
the module. Update the release notes to alert users of this change.
Fixes#43052
Change-Id: I1caf9ef978dd3ac599a3f82c5c376ad62e6fc436
Reviewed-on: https://go-review.googlesource.com/c/go/+/282194
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
For the example in #43551, before late call expansion, the OpArg type is
decomposed to int64. But the late call expansion is currently decompose
it to "x.Key" instead.
This CL make expand_calls decompose further for struct { 1-field type }
and array [1]elem.
This matches the previous rules for early decompose args:
(StructSelect (StructMake1 x)) => x
(ArraySelect (ArrayMake1 x)) => x
Fixes#43551
Change-Id: I2f1ebe18cb81cb967f494331c3d237535d2859e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/282332
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
This change the struct fields for EmbedPatterns and EmbedFiles
to the Package struct listed in the go list documentation that
specifies the fields available to the go list template.
Fixes#43081
Change-Id: I89c325a9d6292a6ce484ee588b172d2f84e2333a
Reviewed-on: https://go-review.googlesource.com/c/go/+/282195
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
The text/template functions are stored in a data structure shared by
all related templates, so do the same with the original, unwrapped,
functions on the html/template side.
For #39807Fixes#43295
Change-Id: I9f64a0a601f1151c863a2833b5be2baf649b6cef
Reviewed-on: https://go-review.googlesource.com/c/go/+/279492
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
This is a pure code move to simplify the diff.
Change-Id: I56ce4d17ed9f003d79f748e267c46a17feefe301
Reviewed-on: https://go-review.googlesource.com/c/go/+/282192
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
In general, we don't want to encourage reading them from CSRs, and
applications that really want to can parse the Extensions field.
Note that this also fixes a bug where the error of
parseKeyUsageExtension was not handled in parseCertificateRequest.
Fixes#43477
Updates #37172
Change-Id: Ia5707b0e23cecc0aed57e419a1ca25e26eea6bbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/281235
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
We are trying to avoid by not automatically updating go.mod. The
suggestion should be that users actually add the dependencies they
need, and the command in an easily copy-pastable form now.
Fixes: #43430
Change-Id: I2227dab498fcd8d66184c94ebe9e776629ccadfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/280713
Run-TryBot: Baokun Lee <bk@golangcn.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
The panic message erroneously refers to float64 values.
Change-Id: I83380f41d6c28a72bc69a94b9bcdf9d42b1503c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/281236
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
This is a port of CL 281546 to go/types.
Change-Id: I6f3d6fa520672d91072f3b5d1a06201320422b57
Reviewed-on: https://go-review.googlesource.com/c/go/+/281992
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Changes from dev.go2go (compare with patchset 1):
+ Update stale comments.
+ Fix a bug in structType where check.atEnd closed over the loop
variable, resulting in incorrect error positions.
+ Fix a bug in the CallExpr clause of typInternal where it didn't check
e.Brackets before checking instantiatedType.
+ Remove support for parenthesized embedded type names.
+ Add an IndexExpr clause to embeddedFieldIdent.
+ Lift the substMap construction out of the loop in funcType when
substituting receiver type parameters.
+ Minor simplification in collectTypeConstraints.
Compare with patchset 1 to see these changes.
Change-Id: I24f10e8615a0bbcd56c86ecf3490ce6a99cfebd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/278916
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>
Earlier (contract-based) versions of the generics design restricted the
kind of types that could be used in a type list - the current design does
not have these restrictions anymore. Remove the respective checking code.
Change-Id: Ia333f7aa8a9c31a92c08acbd5cadba3532a455b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/281546
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This code matches go/types/typexpr but for the necessary adjustments
because of the use of package syntax rather than go/ast, and for the
code being part of cmd/compile/internal/types2 rather than go/types.
Primary differences to go.types/typexpr.go:
- syntax.FuncType doesn't carry type parameters
- type instantiations are represented using syntax.IndexExpr
nodes
- there's an explicit syntax.SliceType
- *x is expressed as a unary operation, not a StarExpr
- grouped fields are identified by identical pointer types
To see the changes copied from recent go/types changes, compare Patchsets 1 and 2.
Change-Id: I8aa9452882d1f5e9529c52a30c7c8e65f3fcbb43
Reviewed-on: https://go-review.googlesource.com/c/go/+/281545
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Fix a deadlock in DumpRequestOut which can occur if the request is
cancelled between response being sent and it being processed.
Also:
* Ensure we don't get a reader leak when an error is reported by the
transport before the body is consumed.
* Add leaked goroutine retries to avoid false test failures.
Fixes#38352
Change-Id: I83710791b2985b997f61fe5b49eadee0bb51bdee
Reviewed-on: https://go-review.googlesource.com/c/go/+/232798
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Damien Neil <dneil@google.com>
modload.Init now sets the default value for -mod if it wasn't set
explicitly. This happens before go.mod is loaded, so
modload.LoadModFile sets the default value again in order to enable
automatic vendoring.
Previously, cfg.BuildMod wasn't set at all if LoadModFile wasn't
called, as is the case for commands that run outside of a module
root. This problem only affected 'go install pkg@version' since other
commands are either forbidden in module mode or run with -mod=mod
(like 'go get' and 'go mod' subcommands).
This change also suppresses "missing sum" errors when -mod=readonly is
enabled and there is no module root.
Fixes#43278
Related #40278
Change-Id: I6071cc42bc5e24d0d7e84556e5bfd8e368e0019d
Reviewed-on: https://go-review.googlesource.com/c/go/+/279490
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
For #41191
Change-Id: I75d327759c3d9ef061c19a80b9b2619038dedf68
Reviewed-on: https://go-review.googlesource.com/c/go/+/281492
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Now that CaptureVars is gone, we can remove the extra code in escape
analysis that only served to appease toolstash -cmp.
Change-Id: I8c811834f3d966e76702e2d362e3de414c94bea6
Reviewed-on: https://go-review.googlesource.com/c/go/+/281544
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Capture analysis is now part of escape analysis.
Passes toolstash -cmp.
Change-Id: Ifcd3ecc342074c590e0db1ff0646dfa1ea2ff57b
Reviewed-on: https://go-review.googlesource.com/c/go/+/281543
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>