Changes from dev.go2go:
+ Update some isComparable cases to use the seen map.
+ Tiny updates to comments.
Change-Id: Iafd85d60835f17a87f514d9774cae07c183ee6cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/278594
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>
Make unify.go match the corresponding and reviewed go/types version.
The remaining differences are due to other differences in the packages.
Also, this version of unify opted to preserve the longer comment around
case tj > 0.
$ diff $GOROOT/src/cmd/compile/internal/types2/unify.go $GOROOT/src/go/types/unify.go
7c7
< package types2
---
> package types
9c9,12
< import "sort"
---
> import (
> "go/token"
> "sort"
> )
120,123d122
< // This case is handled like the default case.
< // case tj > 0:
< // // Only the type parameter for y has an inferred type. Use y slot for x.
< // u.x.setIndex(i, tj)
125,126c124,125
< // Neither type parameter has an inferred type. Use y slot for x
< // (or x slot for y, it doesn't matter).
---
> // Either the type parameter for y has an inferred type, or neither type
> // parameter has an inferred type. In either case, use y slot for x.
216c215
< // basic types and type parameters. We use Named() because we only
---
> // basic types and type parameters. We use asNamed() because we only
219,222c218,221
< case !isNamed(x) && y != nil && y.Named() != nil:
< return u.nify(x, y.Under(), p)
< case x != nil && x.Named() != nil && !isNamed(y):
< return u.nify(x.Under(), y, p)
---
> case !isNamed(x) && y != nil && asNamed(y) != nil:
> return u.nify(x, under(y), p)
> case x != nil && asNamed(x) != nil && !isNamed(y):
> return u.nify(under(x), y, p)
353,354c352,353
< u.check.completeInterface(nopos, x)
< u.check.completeInterface(nopos, y)
---
> u.check.completeInterface(token.NoPos, x)
> u.check.completeInterface(token.NoPos, y)
Change-Id: Icb246d4befedfa82cc3dcfdb7dd162cd4127fbe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/278572
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>
Import dev.go2go changes for exprstring.go, sizes.go, and scope.go.
These files have been reviewed, but are unmodified.
Change-Id: I9df9f8967bab73ce535a539b049346a872877572
Reviewed-on: https://go-review.googlesource.com/c/go/+/278593
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Changes from dev.go2go:
+ Remove support for pointer designation.
+ Remove support for method type parameters in missingMethod. We could
leave this logic in, but it looked sufficiently shaky that I'd rather
not bring in the additional complexity.
+ Remove the strictness flag parameter to assertableTo, since it isn't
used.
Change-Id: I812b8d1c49f3b714b166f061fbb7f2e683a0ce86
Reviewed-on: https://go-review.googlesource.com/c/go/+/278333
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>
Import changes related to tracking type inferences and sanitizing
types.Info from the dev.go2go branch. Notably, the following were all
intentionally omitted from this import:
+ types.Error.Full is not imported, due to it being a public API that
requires some further thought.
+ The Config.AcceptMethodTypeParams, InferFromConstraints, and Trace
flag are not imported. The expectation is that we will not accept
method type parameters for now, will always infer from constraints,
and will continue to use the trace constant to guard tracing.
+ Some trace annotations are not imported to from the checking pass. We
can add them back later, but for now they seemed verbose.
+ Checker.useBrackets is removed. This is no longer configurable.
Change-Id: I7f6315d66b200c92ffd1e55c9fd425a5d99149ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/278312
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>
In package syntax:
- fix parser appendGroup to not add nil entries
- non-string paths are syntax errors per the spec; report in parser
- document ImportDecl.Path invariants
In package types2:
- guard against absent paths
In package gc:
- guard against absent paths
Fixes#43190.
Change-Id: Ic6a06f6a96b7f519feaa1ceaf4376fc5ab0f0129
Reviewed-on: https://go-review.googlesource.com/c/go/+/278114
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
After review, the only non-superficial change was to delegate the call
to under(...) to structuralType. Otherwise, update a few stale comments:
+ correct indices in the documentation for tparamsList
+ update smap->substMap in a few places
+ update type parameter syntax in a couple places
I've spent a good amount of time reviewing this code, and it
fundamentally LGTM (though I wish we didn't have to copy the logic from
identical0). However, as demonstrated in #43056, this code is
complicated and not always easy to reason about, particularly in the
context of type checking where not all types may be complete.
To further understand and verify this code I'd like to write more tests,
but that must wait until the rest of the changes in go/types are
imported from dev.go2go.
Change-Id: Iabb9d3a6af988a2e1b3445cde6bc2431a80f8bfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/276692
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Change-Id: I231e3a1c9f663e2a63c0ad73d571c7a00005f50b
Reviewed-on: https://go-review.googlesource.com/c/go/+/278092
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Changes from dev.go2go:
+ A potentially latent bug is fixed when nilling out tparams in an
instantiated signature (the resulting type could be Typ[Invalid])
+ Support for pointer designation is removed
+ instantiatedHash is updated to use '[]' rather than '()'
+ Several TODOs were added for me to follow-up on, rather than address
in this CL
+ Error callsites are updated. Deciding on error codes and better error
messages is punted to a later CL
These changes can be reviewed by comparing with Patchset #1 of this CL.
Change-Id: Ib5869586b8395419013010e2085cab877727d2ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/276253
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Most syntax.Nodes are allocated in one place and there didn't
seem a need to provide factory methods - so as a matter of
API design, all nodes are "naked", without any constructors.
However, Name nodes are frequently used/replaced and also
are created as helper nodes in clients (types2). Make an
exception and export NewName.
Change-Id: I4b5c499d65bba74592dea68b0936c118b3edaca7
Reviewed-on: https://go-review.googlesource.com/c/go/+/277572
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>
I missed this in the review of CL 277072, but noticed it in CL 277352.
Change-Id: I432e3569eb4a935cee19805225f02c424d54011e
Reviewed-on: https://go-review.googlesource.com/c/go/+/277962
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
This bug was introduced by the change from go/ast to syntax which
represents pointer types as (unary) operations rather than dedicated
StarExpr nodes. Accordingly, this bug does not exist for go/types.
It's still ok to backport the test.
Fixes#43125.
Change-Id: Ic55d913f8afc92862856e1eb7c2861d07fc56cfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/278013
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This fixes the bug below for types2.
Updates #43124.
Change-Id: Ic1962d41f321d8a08992d8529625bc133e526b0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/278012
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Also: Adjusted error patterns for passing test that have different
error messages.
Change-Id: I216294b4c4855aa93da22cdc3c0b3303e54a8420
Reviewed-on: https://go-review.googlesource.com/c/go/+/277994
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
If the parser reported an error for (string) literals, don't report
a second error during type checking.
This should have a couple of tests but they are tricky to arrange
with the current testing framework as the ERROR comment cannot be
on the line where the string. But the change is straightforward
and we have test/fixedbugs/issue32133.go that is passing now.
Change-Id: I0cd7f002b04e4092b8eb66009c7413288c8bfb23
Reviewed-on: https://go-review.googlesource.com/c/go/+/277993
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
The following files had merge conflicts and were merged manually:
src/cmd/compile/fmtmap_test.go
src/cmd/compile/internal/gc/noder.go
src/go/parser/error_test.go
test/assign.go
test/chan/perm.go
test/fixedbugs/issue22822.go
test/fixedbugs/issue4458.go
test/init.go
test/interface/explicit.go
test/map1.go
test/method2.go
The following files had manual changes to make tests pass:
test/run.go
test/used.go
src/cmd/compile/internal/types2/stdlib_test.go
Change-Id: Ia495aaaa80ce321ee4ec2a9105780fbe913dbd4c
Introduce a new utility routine for analyzing a given function
signature to how its various input and output parameters will be
passed (in registers or on the stack) for a given ABI description,
along with some unit tests.
Change-Id: Id64a98a0a142e42dd9c2dc9f6607c0d827ef84fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/273011
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Trust: Than McIntosh <thanm@google.com>
The non-simple, phi-insertion algorithm can leave OpFwdRefs in the SSA
graph unresolved if they're in dead blocks. Normally, these would be
harmlessly removed later during SSA dead-code elimination, but those
passes are omitted for -N builds. And so they reach zcse, where the
Value.Aux is used within a hash map.
This became a problem after golang.org/cl/275788, which added
FwdRefAux to wrap OpFwdRef's ir.Node, and to ensure that it's not
compared for equality / used as a map key.
This CL adds a simple fix: if there are any OpFwdRefs remaining after
resolveFwdRef, then they must be dead code and we can simply replace
them with OpUnknown.
Change-Id: I72e4116d52d3f6441ebb0bf6160906617cd59513
Reviewed-on: https://go-review.googlesource.com/c/go/+/277075
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Add method Type.IsScalar() method, which returns TRUE
for numeric and pointer-shaped types, false for composites
such as string/array/slice/struct.
Change-Id: Ie53c71c07c5b3fbae11b48addd172343dc6bf3fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/274857
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Create a helper routine for initializing the types package, so as make
it easier to use in unit testing (in a follow-on patch).
Change-Id: I0f937788dfd34ac6641a4f28c16e47008aa08116
Reviewed-on: https://go-review.googlesource.com/c/go/+/273010
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
There were only a few places these were still used, none of which
justify generating all this code. Instead rewrite them to use
fmt.Sprint or simpler means.
Passes buildall w/ toolstash -cmp.
Change-Id: Ibd123a1696941a597f0cb4dcc96cda8ced672140
Reviewed-on: https://go-review.googlesource.com/c/go/+/276072
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
This CL make this code match closely with the go/types version
(see https://golang.org/cl/276253).
Change-Id: I2b7841309fdbda7e2c9533768bd98317729b13b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/276814
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Change-Id: I4f1d5d34dd9b26cea8e837a8ff7e833e02c913e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/276815
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>
It just makes the compiler crash. Oops.
Fixes#43099
Change-Id: Id996c14799c1a5d0063ecae3b8770568161c2440
Reviewed-on: https://go-review.googlesource.com/c/go/+/276652
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Use the Key position of a syntax.KeyValueExpr (not the position of the
":") when reporting an error for a missing key.
(In go/types, the KeyValueExpr position is the start of the expression
not the ":", so there this works as expected.)
Change-Id: I74147d245927847274cf4e53b4f03dbb5110c324
Reviewed-on: https://go-review.googlesource.com/c/go/+/276813
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>
Triaged and adjusted more test/fixedbugs/* tests.
Change-Id: I80b9ead2445bb8d126b7d79db4bea9ddcb225a84
Reviewed-on: https://go-review.googlesource.com/c/go/+/276812
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Also: Triaged/adjusted some more test/fixedbugs tests.
Change-Id: I050847b6dfccc7f301f8100bfdbe84e0487e33fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/276512
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Enabled some more test/fixedbugs tests.
Change-Id: I02102b698eedfbee582b3234850fb01418ebbf7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/276453
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Also: Triaged/adjusted some more test/fixedbugs tests.
Change-Id: Idaba1875273d6da6ef82dd8de8edd8daa885d32c
Reviewed-on: https://go-review.googlesource.com/c/go/+/276472
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This is a port of CL 276374 from the dev.typeparams branch. Avoid an
endless recursion in Comparable by tracking types that have already been
considered.
Fixes#43088
Change-Id: I927b29ac544df9bfb5c8c04699d57fafe6cfff73
Reviewed-on: https://go-review.googlesource.com/c/go/+/276552
Run-TryBot: Robert Findley <rfindley@google.com>
Trust: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
os.ReadDir is a replacement for ioutil.ReadDir that returns
a slice of fs.DirEntry instead of fs.FileInfo, meaning it is the
more efficient form.
This CL updates call sites throughout the Go source tree
wherever possible. As usual, code built using the Go 1.4
bootstrap toolchain is not included. There is also a use in
go/build that appears in the public API and can't be changed,
at least not without additional changes.
Fixes#42026.
Change-Id: Icfc9dd52c6045020f6830e22c72128499462d561
Reviewed-on: https://go-review.googlesource.com/c/go/+/266366
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>
As part of #42026, these helpers from io/ioutil were moved to os.
(ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.)
Update the Go tree to use the preferred names.
As usual, code compiled with the Go 1.4 bootstrap toolchain
and code vendored from other sources is excluded.
ReadDir changes are in a separate CL, because they are not a
simple search and replace.
For #42026.
Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/266365
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>
This CL adds Ident, which will eventually replace *Name and *PkgName
within the AST for representing uses of declared names. (Originally, I
intended to call it "IdentExpr", but neither go/ast nor
cmd/compile/internal/syntax include the "Expr" suffix for their
respective types.)
To start, this CL converts two uses of *Name to *Ident: the tag
identifier in a TypeSwitchGuard (which doesn't actually declare a
variable by itself), and the not-yet-known placeholder ONONAME
returned by oldname to stand-in for identifiers that might be declared
later in the package.
The TypeSwitchGuard's Name's Used flag was previously used for
detecting whether none of the per-clause variables were used. To avoid
bloating all Idents for this rare use, a "Used" bool is added to
TypeSwitchGuard instead. Eventually it could maybe be packed into
miniNode.bits, but for now this is good enough.
Passes buildall w/ toolstash -cmp.
Change-Id: I393284d86757cbbebd26e1320c7354e2bdcb30b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/276113
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Prints offsets for declarations, inline bodies, and strings when -v is
used. Still not much, but hopefully useful for narrowing down the
cause of export data differences.
Change-Id: I9b2e4a3d55b92823fa45a39923e8c4b25303693c
Reviewed-on: https://go-review.googlesource.com/c/go/+/276112
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Based on actually using the IR when prototyping adding
type assertions, a few changes to improve it:
- Merge DeferStmt and GoStmt, since they are variants of one thing.
- Introduce LogicalExpr for && and ||, since they (alone) need an init list before Y.
- Add an explicit op to various constructors to make them easier to use.
- Add separate StructKeyExpr - it stores Value in a different abstract location (Left) than KeyExpr (Right).
- Export all fields for use by rewrites (and later reflection).
Passes buildall w/ toolstash -cmp.
Change-Id: Iefbff2386d2bb9ef511ce53b7f92ff6c709dc991
Reviewed-on: https://go-review.googlesource.com/c/go/+/275883
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Ending them in a returning switch makes it safe for each case
to do an appropriate type assertion.
Passes buildall w/ toolstash -cmp.
Change-Id: I55d8f0a555006104164d84d27822aa8c5ad68515
Reviewed-on: https://go-review.googlesource.com/c/go/+/275882
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
ir.Dump is the final (I think!) piece of the compiler that was walking
nodes using Left, Right etc without knowing what they meant.
This CL uses reflection to walk nodes without knowing what they mean instead.
One benefit is that we can print actual meanings (field names).
While we are here, I could not resist fixing a long-standing mental TODO:
make the line number more clearly a line number. I've forgotten where the
line number is in the dumps far too many times in the last decade.
As a small example, here is a fragment of go tool compile -W test/235.go:
. FOR l(28) tc(1)
. . LT-init
. . . AS l(28) tc(1)
. . . . NAME-main..autotmp_4 l(28) x(0) class(PAUTO) esc(N) tc(1) assigned used int
. . . . LEN l(28) tc(1) int
. . . . . NAME-main.xs g(2) l(26) x(0) class(PPARAM) esc(no) tc(1) used SLICE-[]uint64
. . LT l(28) tc(1) hascall bool
. . . NAME-main.i g(4) l(28) x(0) class(PAUTO) esc(no) tc(1) assigned used int
. . . NAME-main..autotmp_4 l(28) x(0) class(PAUTO) esc(N) tc(1) assigned used int
. . BLOCK l(28)
. . BLOCK-list
. . . ASOP-ADD l(28) tc(1) implicit(true) int
. . . . NAME-main.i g(4) l(28) x(0) class(PAUTO) esc(no) tc(1) assigned used int
. . . . LITERAL-1 l(28) tc(1) int
. FOR-body
. . VARKILL l(28) tc(1)
. . . NAME-main..autotmp_4 l(28) x(0) class(PAUTO) esc(N) tc(1) assigned used int
. . IF l(29) tc(1)
. . . LT l(29) tc(1) bool
. . . . INDEX l(29) tc(1) uint64
. . . . . NAME-main.xs g(2) l(26) x(0) class(PPARAM) esc(no) tc(1) used SLICE-[]uint64
. . . . . NAME-main.i g(4) l(28) x(0) class(PAUTO) esc(no) tc(1) assigned used int
. . . . NAME-main.m g(3) l(27) x(0) class(PAUTO) esc(no) tc(1) assigned used uint64
. . IF-body
. . . AS l(30) tc(1)
. . . . NAME-main.m g(3) l(27) x(0) class(PAUTO) esc(no) tc(1) assigned used uint64
. . . . INDEX l(30) tc(1) uint64
. . . . . NAME-main.xs g(2) l(26) x(0) class(PPARAM) esc(no) tc(1) used SLICE-[]uint64
. . . . . NAME-main.i g(4) l(28) x(0) class(PAUTO) esc(no) tc(1) assigned used int
and here it is after this CL:
. FOR tc(1) # 235.go:28
. FOR-Cond
. . LT-init
. . . AS tc(1) # 235.go:28
. . . . NAME-main..autotmp_4 x(0) class(PAUTO) esc(N) tc(1) assigned used int # 235.go:28
. . . . LEN tc(1) int # 235.go:28 int
. . . . . NAME-main.xs g(2) x(0) class(PPARAM) esc(no) tc(1) used SLICE-[]uint64 # 235.go:26
. . LT tc(1) hascall bool # 235.go:28 bool
. . . NAME-main.i g(4) x(0) class(PAUTO) esc(no) tc(1) assigned used int # 235.go:28
. . . NAME-main..autotmp_4 x(0) class(PAUTO) esc(N) tc(1) assigned used int # 235.go:28
. FOR-Post
. . BLOCK # 235.go:28
. . BLOCK-List
. . . ASOP-ADD tc(1) implicit(true) int # 235.go:28 int
. . . . NAME-main.i g(4) x(0) class(PAUTO) esc(no) tc(1) assigned used int # 235.go:28
. . . . LITERAL-1 tc(1) int # 235.go:28
. FOR-Body
. . VARKILL tc(1) # 235.go:28
. . . NAME-main..autotmp_4 x(0) class(PAUTO) esc(N) tc(1) assigned used int # 235.go:28
. . IF tc(1) # 235.go:29
. . IF-Cond
. . . LT tc(1) bool # 235.go:29 bool
. . . . INDEX tc(1) uint64 # 235.go:29 uint64
. . . . . NAME-main.xs g(2) x(0) class(PPARAM) esc(no) tc(1) used SLICE-[]uint64 # 235.go:26
. . . . . NAME-main.i g(4) x(0) class(PAUTO) esc(no) tc(1) assigned used int # 235.go:28
. . . . NAME-main.m g(3) x(0) class(PAUTO) esc(no) tc(1) assigned used uint64 # 235.go:27
. . IF-Body
. . . AS tc(1) # 235.go:30
. . . . NAME-main.m g(3) x(0) class(PAUTO) esc(no) tc(1) assigned used uint64 # 235.go:27
. . . . INDEX tc(1) uint64 # 235.go:30 uint64
. . . . . NAME-main.xs g(2) x(0) class(PPARAM) esc(no) tc(1) used SLICE-[]uint64 # 235.go:26
. . . . . NAME-main.i g(4) x(0) class(PAUTO) esc(no) tc(1) assigned used int # 235.go:28
Note in particular the clear marking of FOR-Cond, FOR-Post, FOR-Body compared to the original.
The only changes to a few test files are the improved field name lines, and of course the line numbers.
Passes buildall w/ toolstash -cmp.
Change-Id: I5b654d9d8ee898976d4c387742ea688a082bac78
Reviewed-on: https://go-review.googlesource.com/c/go/+/275785
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Addressing comments from CL 275434 and CL 275444.
I forgot to run "git rw" to rebase the fixup CLs down before
running "git submit".
Change-Id: Ideaa2340a81511491c096555c6834cd9bdb267d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/275881
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
go test sets the working directory to that of the package being tested,
so opening one of the package source files can be done in a simpler way.
This also allows the test to run in more environments, for example when
GOROOT_FINAL¹ is set.
Also remove the testenv.HasSrc-like check for Go source. The doc.go
file is a part of the package being built and tested, so it's expected
to be available. If it's important for this test to handle when a test
binary is built with go test -c and executed elsewhere without package
source files, something more than testenv.HasSrc would be needed.
¹ https://golang.org/cmd/go/#hdr-Environment_variablesFixes#43085.
Change-Id: Ie6ade395a8fc7beebdadbad6f4873800138dfc26
Reviewed-on: https://go-review.googlesource.com/c/go/+/276452
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Use a map to detect recursive types.
With this we can now typecheck fixedbugs/issue8501.go.
Updates #43088.
Change-Id: I7fad6ccf6c94268473ff72b09a3158e13a7f4cc3
Reviewed-on: https://go-review.googlesource.com/c/go/+/276374
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>
Issue #41600 fixed the issue when a second request canceled a connection
while the first request was still in roundTrip.
This uncovered a second issue where a request was being canceled (in
roundtrip) but the connection was put back into the idle pool for a
subsequent request.
The fix is the similar except its now in readLoop instead of roundTrip.
A persistent connection is only added back if it successfully removed
the cancel function; otherwise we know the roundTrip has started
cancelRequest.
Fixes#42942
Change-Id: Ia56add20880ccd0c1ab812d380d8628e45f6f44c
Reviewed-on: https://go-review.googlesource.com/c/go/+/274973
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
This fixes the unexpected growth of stack in child process, which
is caused by stack checking code in runtime.sigfillset called from
runtime.sigset while clearing the signal handlers in child process.
The redundant stack checking code is generated due to missing
'//go:nosplit' directive that should be annotated for
runtime.sigfillset.
Fixes#43066
Updates #21314
Change-Id: I9483a962a4b0747074313991841e2440ee32198c
Reviewed-on: https://go-review.googlesource.com/c/go/+/276173
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Vendor in latest x/tools.
Add framepointer vet check to vet.
Fixes#43014
Change-Id: Ife72f85b1261aa60c0028041c58040d60a40918a
Reviewed-on: https://go-review.googlesource.com/c/go/+/276372
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
With the plurality of CLs importing dev.go2go changes it's getting hard
to track all of the code review comments that were deferred for later
consideration. Add some TODOs to capture these comments in the source,
so that they may be more easily located.
Change-Id: I5caf085fec11ca8992b7affe6feb0a7aa202f21f
Reviewed-on: https://go-review.googlesource.com/c/go/+/276254
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>
This is a port of CL 275517 from the dev.typeparams branch, to fix the
positioning of error messages for invalid const init expressions that
are inherited.
Differences from CL 275517:
+ The inherited flag is added to the constDecl intermediate
representation.
+ The errpos override is made a positioner, the internal interface
used by go/types to capture error position and span. For const decls
errpos is just set to a singular point, but using positioner is
correct and causes span start and end positions to also be
overridden.
+ Test cases are updated to assert on just 'overflows', as the go/types
error message is, for example, "cannot use 255 + iota (untyped int
constant 256) as byte value in constant declaration (overflows)".
This is more verbose than the compiler's "constant 256 overflows
byte", but changing that is out of scope.
Fixes#42991
Change-Id: I0a71d2290f7fff5513f2a6e49b83e6f0f4da30e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/276172
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
This is unmodified from the dev.go2go branch, except to remove the aType
embedding.
Change-Id: Id14d97a56d27ea609c43b453e8f9f1cf1a451406
Reviewed-on: https://go-review.googlesource.com/c/go/+/276252
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>