This will permit us to write ABIInternal assembler code for linux-amd64.
For #40724
Change-Id: I681866651554eda4229d6faa7f0c1ba42d07e57d
Reviewed-on: https://go-review.googlesource.com/c/go/+/315390
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TestManual is used for debugging; in this case we usually want to
see error messages reported rather than checked against ERROR comments
in the provided files. Make this the default. Use the new -verify
flag to verify reported errors against ERROR comments.
With this change we cannot get an error list for the non-manual
tests, but that is usually not useful anyway because there are
usually many errors in those test files. Run those tests manually
instead.
Also, corrected -lang flag synopsys: it applies to all tests, not
just TestManual.
Change-Id: I56e0ea0583840fc3ea150d9ccfc330370b66191c
Reviewed-on: https://go-review.googlesource.com/c/go/+/315729
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Running the TestManual test (for manual debugging) requires
user-provided files as input. Rather than using another flag
(-files) to provide these files, just use the (remaining)
command line arguments.
Change-Id: I9b20d9f1a6a7ce839bbd690c311ce3f0d0a10496
Reviewed-on: https://go-review.googlesource.com/c/go/+/315689
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>
The Go object file format can change from version to version.
Tools like cmd/objdump and cmd/nm only onderstand the current
version of the object file. Currently, when it encounters an
object built with a different version of the toolchain, it emits
a generic error "unrecognized object file", which is not very
helpful for users. This CL makes it emit a clearer error. Now it
emits
objdump: open go116.o: go object of a different version: go116ld
Change-Id: I063c6078ed1da78f97cea65796779ae093a1a8cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/315609
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Adds a method within Values for detecting whether a query parameter is set.
Fixes#45100
Change-Id: I6bb49417e8547e11cc7e8d55c5211d24ee436ec1
GitHub-Last-Rev: 0b27cdab90
GitHub-Pull-Request: golang/go#45835
Reviewed-on: https://go-review.googlesource.com/c/go/+/314850
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
Change-Id: I897864984bd4b79f2e224ea1a7f323e0bd5e2ef0
GitHub-Last-Rev: b85415541d
GitHub-Pull-Request: golang/go#45849
Reviewed-on: https://go-review.googlesource.com/c/go/+/314991
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ben Shi <powerman1st@163.com>
Trust: Matthew Dempsky <mdempsky@google.com>
golang.org/cl/284138 introduced a regression: running "gofmt foo" would
silently ignore the file due to its lack of a ".go" extension, whereas
the tool is documented otherwise:
Given a file, it operates on that file; given a directory, it
operates on all .go files in that directory, recursively.
This wasn't caught as there were no tests for these edge cases. gofmt's
own tests are regular Go tests, so it's hard to test it properly without
adding an abstraction layer on top of func main.
Luckily, this kind of test is a great fit for cmd/go's own script tests,
and it just takes a few straightforward lines.
Finally, add the relevant logic back, with documentation to clarify its
intentional purpose.
Fixes#45859.
Change-Id: Ic5bf5937b8f95fcdad2b6933227c8b504ef38a82
Reviewed-on: https://go-review.googlesource.com/c/go/+/315270
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
Trust: Robert Griesemer <gri@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Sort the comment map entries before printing.
Makes it easier to use the output for debugging.
For #39753.
Change-Id: Ic8e7d27dd2df59173e2c3a04a6b71ae966703885
Reviewed-on: https://go-review.googlesource.com/c/go/+/315370
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
These generate similar machine code sequences to
other symbol accesses, therefore we should merge them.
Change-Id: Id8ead284d430fadd2e58bad255deb465498dfade
Reviewed-on: https://go-review.googlesource.com/c/go/+/314109
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
When the class of p.To is C_NAUTO4K, STP series instructions will be translated
into add/sub + stp instructions, the total size is 8. Currently this size
value in optab is 12, this CL fixes it.
Change-Id: Ife1b9e9f8a28edca9b59f62b45a80d83f38993b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/314210
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: eric fang <eric.fang@arm.com>
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
There's no reason not to, and it'll help me test an upcoming fix
for #43956. The API additions look reasonable to me, and they'll
go through a more comprehensive API audit during the freeze.
Change-Id: I0daa6e978b199d69568f5100fdfc1b4bcfaeaef2
Reviewed-on: https://go-review.googlesource.com/c/go/+/315349
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The original value was rounded too early, which lead to the
surprising behavior that float64(math.SmallestNonzeroFloat64 / 2)
wasn't 0. That is, the exact compile-time computation of
math.SmallestNonzeroFloat64 / 2 resulted in a value that was
rounded up when converting to float64. To address this, added 3
more digits to the mantissa, ending in a 0.
While at it, also slightly increased the precision of MaxFloat64
to end in a 0.
Computed exact values via https://play.golang.org/p/yt4KTpIx_wP.
Added a test to verify expected behavior.
In contrast to the other (irrational) constants, expanding these
extreme values to more digits is unlikely to be important as they
are not going to appear in numeric computations except for tests
verifying their correctness (as is the case here).
Re-enabled a disabled test in go/types and types2.
Updates #44057.
Fixes#44058.
Change-Id: I8f363155e02331354e929beabe993c8d8de75646
Reviewed-on: https://go-review.googlesource.com/c/go/+/315170
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Currently, for stack objects, the compiler emits metadata that
includes the offset and type descriptor for each object. The type
descriptor symbol has many fields, and it references many other
symbols, e.g. field/element types, equality functions, names.
Observe that what we actually need at runtime is only the GC
metadata that are needed to scan the object, and the GC metadata
are "leaf" symbols (which doesn't reference other symbols). Emit
only the GC data instead. This avoids bringing live the type
descriptor as well as things referenced by it (if it is not
otherwise live).
This reduces binary sizes:
old new
hello (println) 1187776 1133856 (-4.5%)
hello (fmt) 1902448 1844416 (-3.1%)
cmd/compile 22670432 22438576 (-1.0%)
cmd/link 6346272 6225408 (-1.9%)
No significant change in compiler speed.
name old time/op new time/op delta
Template 184ms ± 2% 186ms ± 5% ~ (p=0.905 n=9+10)
Unicode 78.4ms ± 5% 76.3ms ± 3% -2.60% (p=0.009 n=10+10)
GoTypes 1.09s ± 1% 1.08s ± 1% -0.73% (p=0.027 n=10+8)
Compiler 85.6ms ± 3% 84.6ms ± 4% ~ (p=0.143 n=10+10)
SSA 7.23s ± 1% 7.25s ± 1% ~ (p=0.780 n=10+9)
Flate 116ms ± 5% 115ms ± 6% ~ (p=0.912 n=10+10)
GoParser 201ms ± 4% 195ms ± 1% ~ (p=0.089 n=10+10)
Reflect 455ms ± 1% 458ms ± 2% ~ (p=0.050 n=9+9)
Tar 155ms ± 2% 155ms ± 3% ~ (p=0.436 n=10+10)
XML 202ms ± 2% 200ms ± 2% ~ (p=0.053 n=10+9)
Change-Id: I33a7f383d79afba1a482cac6da0cf5b7de9c0ec4
Reviewed-on: https://go-review.googlesource.com/c/go/+/313514
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Add missing version check. Even though this is a new types2 error
we separate between the compiler and the types2 error message: we
have the compiler error message to match the compiler style, and
we have a types2-specific error message to match the types2 style
for these kinds of errors (for now).
Eventually we need to decide which style we like better and clean
this up.
Follow-up on https://golang.org/cl/301650.
Updates #395.
Change-Id: I5b779f345994c66b1f4a4db466466f98b7d3c491
Reviewed-on: https://go-review.googlesource.com/c/go/+/315169
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
For GC mask symbols, we don't need to create types.Sym, just the
LSym.
Change-Id: I285b518cfd60bfaa3202a02b3005a7122daeb338
Reviewed-on: https://go-review.googlesource.com/c/go/+/313512
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This change adds four additional metrics to the runtime/metrics package
to fill in a few gaps with runtime.MemStats that were overlooked. The
biggest one is TotalAlloc, which is impossible to find with the
runtime/metrics package, but also add a few others for convenience and
clarity. For instance, the total number of objects allocated and freed
are technically available via allocs-by-size and frees-by-size, but it's
onerous to get them (one needs to sum the sample counts in the
histograms).
The four additional metrics are:
- /gc/heap/allocs:bytes -- total bytes allocated (TotalAlloc)
- /gc/heap/allocs:objects -- total objects allocated (Mallocs - [tiny])
- /gc/heap/frees:bytes -- total bytes frees (TotalAlloc-HeapAlloc)
- /gc/heap/frees:objects -- total objects freed (Frees - [tiny])
This change also updates the descriptions of allocs-by-size and
frees-by-size to be more precise.
Change-Id: Iec8c1797a584491e3484b198f2e7f325b68954a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/312431
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Add a little more detail to the ssa README relating to GOSSAFUNC.
Update the -d=ssa help section to give a little more detail on what
to expect with applying the /debug=X qualifier to a phase.
Change-Id: I7027735f1f2955dbb5b9be36d9a648e8dc655048
Reviewed-on: https://go-review.googlesource.com/c/go/+/315229
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Store the precomputed P-256 basepoint table in source rather than
computing it at runtime, saving ~88kB from the heap. The flip side
is that this increases binary sizes by ~77kB.
Fixes#44992
Change-Id: Ia5421eae87b41522b0d8cecba051cba1d2ed73db
Reviewed-on: https://go-review.googlesource.com/c/go/+/315189
Run-TryBot: Roland Shoemaker <roland@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
While we're here fix the ModTime value for directories.
Fixes#43872Fixes#45345
Change-Id: I155e6517713ef6a9482b9431f1167a44337c6ad2
Reviewed-on: https://go-review.googlesource.com/c/go/+/311530
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This enables a consumer of a CSV to find out the position
of a CSV field without implementing an intermediate buffer.
This is useful to produce good higher level error messages when
the CSV syntax is OK but the field values don't match expectations.
This also changes the existing semantics of the `ParseError.Column`
field to bring it in line with precedent elsewhere in the Go
standard library (notably go/token.Position) - the column is
now 1-based and indicates a byte count rather than a rune count,
and the error position reporting at the end of a last line without
a newline is now fixed.
This change has some impact on performance:
```
name old time/op new time/op delta
Read-8 2.14µs ± 0% 2.15µs ± 0% ~ (p=0.056 n=5+5)
ReadWithFieldsPerRecord-8 2.15µs ± 2% 2.15µs ± 1% ~ (p=0.151 n=5+5)
ReadWithoutFieldsPerRecord-8 2.15µs ± 0% 2.15µs ± 0% +0.37% (p=0.024 n=5+5)
ReadLargeFields-8 3.55µs ± 2% 3.59µs ± 0% ~ (p=0.206 n=5+5)
ReadReuseRecord-8 1.18µs ± 1% 1.22µs ± 1% +2.93% (p=0.008 n=5+5)
ReadReuseRecordWithFieldsPerRecord-8 1.18µs ± 0% 1.21µs ± 0% +2.54% (p=0.008 n=5+5)
ReadReuseRecordWithoutFieldsPerRecord-8 1.18µs ± 0% 1.22µs ± 1% +3.66% (p=0.008 n=5+5)
ReadReuseRecordLargeFields-8 2.53µs ± 1% 2.57µs ± 1% +1.70% (p=0.008 n=5+5)
Write-8 1.02µs ± 1% 1.01µs ± 0% -1.18% (p=0.016 n=5+4)
```
Fixes#44221.
Change-Id: Id37c50fc396024eef406c5bad45380ecd414f5ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/291290
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Paul Jolly <paul@myitcv.org.uk>
Top align allocations in tinyalloc buckets when in race mode.
This will make checkptr checks more reliable, because any code
that modifies a pointer past the end of the object will trigger
a checkptr error.
No test, because we need -race for this to actually kick in. We could
add it to the race detector tests, but the race detector tests are all
geared towards race detector reports, not checkptr reports. Mucking
with parsing reports is more than a test is worth.
Fixes#38872
Change-Id: Ie56f0fbd1a9385539f6631fd1ac40c3de5600154
Reviewed-on: https://go-review.googlesource.com/c/go/+/315029
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
iOS arm64 is a 64-bit platform but with a strictly 32-bit address space
(technically 33 bits, but the bottom half is unavailable to the
application). Since address space is limited, use 4 MiB arenas instead
of 64 MiB arenas. No changes are needed to the arena index because it's
still relatively small; this change just brings iOS more in line with
32-bit platforms.
Change-Id: I484e2d273d896fd0a57cd5c25012df0aef160290
Reviewed-on: https://go-review.googlesource.com/c/go/+/270538
Trust: Michael Knyszek <mknyszek@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Add some test data files that were not included in go/types.
- Issue 43125 only pertained to types2 because go/ast differentiates
StarExpr, UnaryExpr, and BinaryExpr, so typexpr.go was already
catching the invalid type expressions.
- Issues 42987 and 43190 are handled differently by go/parser.
- main.go2 was not added when ported to go/types, because this work
happened on the dev.regabi branch, which didn't support generics.
Test files are modified to adjust errors messages and positions, and to
update the copyright year.
Change-Id: Ia737eaab9afb2b59600b661ccf3eec3cbbb2d66c
Reviewed-on: https://go-review.googlesource.com/c/go/+/315070
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 CL 314452, for ARM.
Fixes#30949.
Change-Id: Ib4e46a5bd11c698c4f8ea3bc4e7a605d7a538efc
Reviewed-on: https://go-review.googlesource.com/c/go/+/314455
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
When internal linking with C objects, some C object relocations
may be turned into a CALL via PLT. For very large programs, the
PLT stub may be laid too far.
PLT stubs are generated late in the linker, and laid out after
the end of the text section. So if the text section is big, the
PLT stubs are likely too far.
To avoid this situation, add trampolines for PLT calls in the
trampoline pass. Only do this when the program is known too large
(i.e. the second pass of the two-pass algorithm).
Updates #40492.
Change-Id: I21f65d6cbc6bde84e3cf9c2ae05f5233df6cfa72
Reviewed-on: https://go-review.googlesource.com/c/go/+/314452
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Compared to ARM32 or PPC64, ARM64 has larger range for direct jumps.
But for very large programs it can still go over the limit. Add
trampoline insertion for ARM64.
Updates #40492.
Change-Id: Id97301dbc35fb577ba3f8d5f3316a8424d4f53c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/314451
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
It's never called.
Change-Id: I8956743b21301816b5f37a9b34e3f50ef7b2e70a
Reviewed-on: https://go-review.googlesource.com/c/go/+/314771
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Change-Id: Iec9de5ca56eb68d524bbaa0668515dbd09ad38a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/314770
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Currently in the linker, for trampoline insertion it does a one-pass
approach, where it assigns addresses for each function and inserts
trampolines on the go. For this to work and not to emit too many
unnecessary trampolines, the functions need to be laid out in
dependency order, so a direct call's target is always as a known
address (or known to be not too far).
This mostly works, but there are a few exceptions:
- linkname can break dependency tree and cause cycles.
- in internal linking mode, on some platforms, some calls are turned
into calls via PLT, but the PLT stubs are inserted rather late.
Also, this is expensive in that it has to investigate all CALL
relocations.
This CL changes it to use a two-pass approach. The first pass is
just to assign addresses without inserting any trampolines, assuming
the program is not too big. If this succeeds, no extra work needs to
be done. If this fails, start over and insert trampolines for too-
far targets as well as targets with unknown addresses. This should
make it faster for small programs (most cases) and generate fewer
conservative trampolines.
Change-Id: Ib13e01f38ec6dfbef1cd446b06da33ee17bded5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/314450
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
PLT and GOT are used more than on PE. Update the comment.
Change-Id: Iaddb326680a7709a1442675a38c021331be32472
Reviewed-on: https://go-review.googlesource.com/c/go/+/314929
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This CL is a mix of CL 312149 and CL 314409, adding the
Checker.singleIndex method to provide better error messages when an
unexpected ListExpr is encountered.
Change-Id: I45d6de9b4dfc299dc2d356ca14d05c9191de818d
Reviewed-on: https://go-review.googlesource.com/c/go/+/314869
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>
Over this cycle some error code values have changed due to codes being
added/removed. This is probably OK to do once more before we export
error codes in a later Go version, but for now let's keep them stable.
Move things around to correct the changes, and update comments in
errorcodes.go to make it clearer that new codes should be added at the
end.
Change-Id: Id32827ef1a72cfd876ccc039da11d0a1be7470e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/314830
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>
Having multiple subdirectories of go/types containing test data is
slightly problematic:
- If ever we were to include a .go file in one of these directories,
we'd inadvertently create a visible package.
- It's difficult to add other content in testdata/, since TestTestdata
scans the entire directory.
Move everything down a level, into testdata/{fixedbugs,examples,check},
and update tests accordingly.
Change-Id: Idd074c94b7b261d678934330539e41a48c2a9dc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/314829
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Fixes#45594.
Change-Id: I2fcc784e6908403dd96b009546e1ac2f53b9f0e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/314776
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
There was only one meaningful caller, which changes to call time_now.
This clearly separates systems that use walltime1 to be just those
that use the stub version of time_now. That is to say, those that do
not provide an assembler version of time_now.
Change-Id: I14c06cc402070bd705f953af6f9966785015e2a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/314769
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This is a 1:1 port of CL 313650 to go/types.
Change-Id: Iec01ac2831f21162d9977a139549e081ee769f90
Reviewed-on: https://go-review.googlesource.com/c/go/+/314631
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 312170 to go/types, adjusted to use go/ast and to
add error codes. go/parser already emits errors for non-identifiers on
the LHS of a short var decl, so a TODO is added to reconsider this
redundancy.
A new error code is added for repeated identifiers in short var decls.
This is a bit specific, but I considered it to be a unique kind of
error.
The x/tools tests for this port turned up a bug: the new logic failed to
call recordDef for blank identifiers. Patchset #2 contains the fix for
this bug, both in go/types and cmd/compile/internal/types2.
Change-Id: Ibdc40b8b4ad0e0696111d431682e1f1056fd5eeb
Reviewed-on: https://go-review.googlesource.com/c/go/+/314629
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 1:1 port of CL 311651 to go/types.
Change-Id: I9d91b45cc5fa7ce686d6a91d4dde274d9f80e0d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/314595
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>
Build other definitions with the !faketime build tag.
This makes it easy for us to add new assembly implementations of time.now.
Change-Id: I4e48e41a4a04ab001030e6d1cdd9cebfa0161b0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/314274
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This is a step toward separating whether time.now is implemented in
assembly from whether we are using faketime.
Change-Id: I8bf059b44a103b034835e3d3b799319cc05e9552
Reviewed-on: https://go-review.googlesource.com/c/go/+/314273
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This is a 1:1 port of CL 309830 to go/types.
Change-Id: Ibf709f8194dd5e93a87145e5f9db674ce93af529
Reviewed-on: https://go-review.googlesource.com/c/go/+/314594
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 308973. The only change is to remove a TODO at
inference.go2:100 to improve the error position. The go/types error
position is fine.
Change-Id: Ibf61f3458adde91dec9c7531cbd892ca654a5497
Reviewed-on: https://go-review.googlesource.com/c/go/+/314593
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>