1
0
mirror of https://github.com/golang/go synced 2024-11-17 04:24:47 -07:00
Commit Graph

50724 Commits

Author SHA1 Message Date
Dan Scales
e8cda0a6c9 cmd/compile: don't run ComputeAddrTaken on imported generic functions
It causes a crash because of the unexpected XDOT operation. It's not
needed, since we will run ComputeAddrTaken() on function instantiations
after stenciling. And it's not always correct, since we may not be able
to distinguish between a array and a slice, if a type is dependent on a
type param.

However, we do need to call ComputeAddrTaken on instantiations created
during inlining, since that is after the main ComputeAddrTaken pass.

Fixes #49659

Change-Id: I0bb610cf11f14e4aa9068f6ca2a012337b069c79
Reviewed-on: https://go-review.googlesource.com/c/go/+/365214
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-11-19 00:05:59 +00:00
Ian Lance Taylor
2375b6edf3 cmd/go/internal/test: add dep from test pkg build to real pkg build
If we have to build a test package, and if the full set of packages
being tested imports the regular package somewhere, then make building
the test package depend on building the regular package.  That way if
the regular package fails to build we only report the error once.

Fixes #44624

Change-Id: Ic7d66d8fec9c4688d369153a4b21194989f8def3
Reviewed-on: https://go-review.googlesource.com/c/go/+/365215
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>
2021-11-18 22:40:42 +00:00
Robert Griesemer
24898d6948 spec: various clarifications/fixes for method sets and interfaces
- fixed a typo in the method set section
- express in the syntax that ~T denotes an underlying type
- be more precise when talking about types vs type terms
- refer to "unions" rather than "union expressions"
- make it clear in the spec title that this is WIP

Change-Id: I9b2c4b1f77bc50dd574ed6893bedd40529c320fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/365154
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-18 20:11:45 +00:00
Mikhail Faraponov
c4aae23d64 net: optimize ctxDone usage
Change-Id: I6db6fcf0ebe36da77af062114b5264405f15fee8
GitHub-Last-Rev: 80a97262bb
GitHub-Pull-Request: golang/go#49620
Reviewed-on: https://go-review.googlesource.com/c/go/+/364514
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
2021-11-18 19:16:38 +00:00
Robert Findley
feb330dcdd go/types: add test for imported constraints pre-1.18
This is a port of CL 363834 from types2 to go/types.

Change-Id: I32583ead4bce626e0761f4c327678050404a15c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/364937
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>
2021-11-18 16:18:50 +00:00
Robert Findley
8d6c4e07fd go/types: use "implements" rather than "satisfies" in error messages
This is a port of CL 363839 from types2 to go/types.

Change-Id: I9efe412a6a602fd55170d1ee89c8e1513037c926
Reviewed-on: https://go-review.googlesource.com/c/go/+/364936
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>
2021-11-18 14:08:30 +00:00
Robert Findley
5d5f2b1e20 go/types: remove unneccesary tests in implements and lookup
This is a port of CL 363838 from types2 to go/types.

Change-Id: I03f4da86ea38209a73f567cc5d84e7afd08883ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/364935
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>
2021-11-18 14:08:10 +00:00
Robert Findley
9ea939be60 go/types: implement Checker.implements
This is a port of CL 363837 from types2 to go/types. As usual, test
error messages had to be repositioned on the operand.

Change-Id: I2b53fae7aa30f9147f8d05f75b0ab252338320bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/364934
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>
2021-11-18 14:08:03 +00:00
Than McIntosh
14c3f749be cmd/link: relocate dwarf examiner helper to separate package
The linker DWARF test includes an "examiner" helper type (with
associated methods) that is used to help linker DWARF tests read DWARF
info in a higher level and more structured way than just raw
debug/dwarf operations. This patch extracts out "examiner" and
relocates it to a separate package, so that it can be used in other
package tests as well, if need be.

Change-Id: Iec66061e2719ee698c12d8fa17b11698442b336d
Reviewed-on: https://go-review.googlesource.com/c/go/+/364036
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>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-11-18 14:00:00 +00:00
Robert Griesemer
f6647f2e3b spec: generalize method sets and interface types to type sets
This is the first of several CLs that update the existing
Go 1.17 spec for type parameters.

This CL updates the section on method sets and interface types.
It also adds "any", "comparable" to the list of predeclared
identifiers.

Change-Id: I0ce25dc02791c33150c0d949528512610faf3eab
Reviewed-on: https://go-review.googlesource.com/c/go/+/362999
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-18 06:05:29 +00:00
Keith Randall
d8f7a64519 test: make issue8606b test more robust
Use actual unmapped memory instead of small integers to make
pointers that will fault when accessed.

Fixes #49562

Change-Id: I2c60c97cf80494dd962a07d10cfeaff6a00f4f8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/364914
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-11-18 02:53:02 +00:00
Robert Findley
f1cc529429 go/types: better position for invalid slice indices error
This is a port of CL 363671 from types2 to go/types. Also adjust the
error message to match types2 ("invalid" vs "swapped").

Change-Id: I662a73c915814fea14bfcb1ebde0fbf39589f022
Reviewed-on: https://go-review.googlesource.com/c/go/+/364902
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>
2021-11-18 02:19:50 +00:00
Robert Findley
72f0976ac4 go/types: better position for "3-index slice of string" error
This is a port of CL 363670 from types2 to go/types.

Change-Id: I2ac3a5f86bb4eafddd2854e193083b2b737e29b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/364901
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>
2021-11-18 02:18:12 +00:00
Robert Findley
3404ee3e86 go/types: move match function to end of file (cleanup)
This is a port of CL 363669 from types2 to go/types.

Change-Id: Id1f375ff5708dab528144e30ce16d24d6fdf7d00
Reviewed-on: https://go-review.googlesource.com/c/go/+/364900
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>
2021-11-18 02:17:34 +00:00
Robert Findley
ce7e5013a6 go/types: allow slicing for operands with []byte|string type sets
This is a port of CL 363662 from types2 to go/types. An error message
was adjusted to be on the operand in test data.

Change-Id: I4d2d69976f4f05e0d89ba1c6bf8b3e4cf1a82316
Reviewed-on: https://go-review.googlesource.com/c/go/+/364899
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>
2021-11-18 02:17:23 +00:00
Robert Findley
353cb71ea2 go/types: optimize common case in structuralType
This is a port of CL 363668 from types2 to go/types.

Change-Id: Ic55acb2e27f57c33467cef2f687cd695e092ba6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/364898
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>
2021-11-18 02:16:39 +00:00
Robert Findley
2463b4fcaf go/types: simplify under() and fix a crash
This is a port of CL 363665 from types2 to go/types.

Change-Id: I20c4e20ab97f1e4de66a29095dc4a9b160810fe5
Reviewed-on: https://go-review.googlesource.com/c/go/+/364897
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>
2021-11-18 02:15:36 +00:00
Robert Findley
b95bff0318 go/types: remove tparamIsIface flag and corresponding dead code
This is a port of CL 363654 from types2 to go/types.

Change-Id: I64041615ccc7f11f2e4ae395b063ec5141ccf2cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/364896
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>
2021-11-18 02:14:25 +00:00
Robert Findley
9115a7ba4a go/types: remove asNamed
This is a port of CL 363441 from types2 to go/types, with an additional
adjustment in methodset.go.

Change-Id: Ia04dcfb70bb9f6af6f45175dee3334dba7b2768e
Reviewed-on: https://go-review.googlesource.com/c/go/+/364895
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>
2021-11-18 02:11:51 +00:00
Robert Findley
e3b48af575 go/types: remove a review comment in implicitTypeAndValue
This is a clean port of CL 363440 from types2 to go/types.

Change-Id: Ibbef41b5b599d5c88f7122670ab87aa5be512c0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/364894
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>
2021-11-18 02:10:22 +00:00
Ian Lance Taylor
0440fb8334 runtime: make faketime more robust against GC
When using faketime, only run the scavenger for one loop.
It tries to run for 1 ms, but with faketime that calculation fails.

Prohibit write barriers in the faketime write function, in case
the GC wants to print something (e.g., with GODEBUG=gctrace=1).

Fixes #49614

Change-Id: Iab5097fe78b6e0032ea8b493088264dfb25013c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/364757
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-17 21:26:25 +00:00
Roland Shoemaker
a218365fae cmd/go: skip broken fuzz test
For #49047

Change-Id: If06ce033f7bfd23d640311f1be261afab8332028
Reviewed-on: https://go-review.googlesource.com/c/go/+/364758
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-17 21:25:16 +00:00
Robert Findley
9a33945f2c go/types: set tparamsIsIface to true
This is a port of CL 363155 from types2 to go/types.

Change-Id: Ic24f8c88513599c8f4685f0b66d3782ac4e6831a
Reviewed-on: https://go-review.googlesource.com/c/go/+/364717
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>
2021-11-17 19:51:32 +00:00
Robert Findley
88474d47dd go/types: underlying type of a type parameter is its constraint interface
This is a port of CL 359016 from types2 to go/types. Some of the code
around untyped nil differed (because we have to treat untyped nil
differently in go/types for historical reasons).

Updates #47916

Change-Id: Ifc428ed977bf2f4f84cc831f1a3527156940d7b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/364716
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>
2021-11-17 19:50:58 +00:00
Ian Lance Taylor
aa34ea2f4c runtime: don't run TestCheckPtr/TestCheckPtr2 in short mode
Change-Id: I02c9bea1637c2694a76e7747cb8a2e3562301566
Reviewed-on: https://go-review.googlesource.com/c/go/+/364755
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-11-17 19:18:24 +00:00
Robert Findley
0981724eae go/types: check for non-negative index in tparamIndex
There are code paths (particularly error formatting or tracing) that
call tparamIndex before the type parameter is bound. We cannot rely on
the index being non-negative.

Change-Id: Ibad91c691b4f319b0c7b465a750b679a8a7af6a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/364715
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>
2021-11-17 18:14:41 +00:00
Robert Findley
9bdbed1d96 go/types, types2: complete methods on pointer receivers in missingMethod
We were not calling objDecl on methods on pointer receivers in
missingMethod. This may not have mattered before, but with lazy
completion of instance methods it is necessary.

Fixes #49579

Change-Id: Icddb1f3b16bef7d8017859734f9879a4f1cc18de
Reviewed-on: https://go-review.googlesource.com/c/go/+/364714
Trust: Robert Findley <rfindley@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-17 18:14:23 +00:00
Robert Findley
17b7604ef6 go/types: match Go 1.17 compiler error messages more closely
Introduce a new constant compilerErrorMessages, which is set to false
for now, so that we can port types2 error handling more precisely. Use
this to (partially) port CL 363436, excluding issue49005.go, which does
not exist in go/types (it was added in a previous CL related to compiler
error messages, that was not ported). I've also included the bugfix from
CL 364034, so that go/types is not broken at this commit.

In subsequent CLs I'll catch up with error handling locations in types2
that use compiler error messages.

Change-Id: I13fd6c43d61b28e0a7a3b0ae8ba785fb8506fbb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/364379
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>
2021-11-17 18:14:06 +00:00
Ian Lance Taylor
0555ea3ce9 runtime: don't serialize all builds in test
Permit a test whose program is already built to run immediately,
rather than waiting for another test to complete its build.

For #44422

Change-Id: I2d1b35d055ee4c4251f4caef3b52dccc82b71a1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/364654
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-17 17:36:36 +00:00
Roland Shoemaker
ab75484d71 internal/fuzz: limit number of consecutive mutations
This makes two changes: (1) mutator.mutate now only applies a single
mutation to the input, and (2) in workerServer.fuzz if, after five
mutations are applied to the input, no new coverage is found the input
is reset to its initial state. This process is repeated until new
coverage is found, or the fuzz call times out.

This results in finding new coverage expanding inputs which have less
divergence from the initial input they were mutated from, which makes
traversing certain types of call graphs significantly more efficient.

Fixes #49601
Fixes #48179
Fixes #47090

Change-Id: I74d18a56ca2669f20192951090b281f58ee0b5dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/364214
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-11-17 17:16:18 +00:00
Patrik Nyblom
54b9cb8037 runtime: make sure to properly park before going to sleep in Windows ConsoleControlHandler
This change avoids the program intermittently hanging on windows/arm64 after getting
a signal for which the ConsoleControlHandler can not return.

Fixes #49458

Change-Id: Ie28f0f437c7e0f9634b6b3e29dc6cdebd5d996f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/364556
Trust: Patrik Nyblom <pnyb@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Patrik Nyblom <pnyb@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-17 17:04:16 +00:00
Robert Findley
4083a6f377 go/types: better error for type assertion/switch on type parameter value
This is a port of CL 363439 from types2 to go/types.

Change-Id: Ic71871874345e1d0a4a42703e3673aadd11f2bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/364378
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>
2021-11-17 14:10:29 +00:00
Cuong Manh Le
1d004fa201 cmd/compile: emit definition of 'any' only if generic enabled
CL 364377 emitted definition of 'any' when compiling runtime. But 'any'
is only available when generic enabled. Thus emitting its definition
unconditionally causes the compiler crashes.

Updates #49619

Change-Id: I0888ca1cbc7a7df300310a99a344f170636333f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/364614
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-11-17 04:55:12 +00:00
Robert Griesemer
03dd049d6e go/types: make sure we are safe for nil in underIs
This CL is a clean port CL 363658 from types2 to go/types.

Change-Id: Ie2032f85a9cfca62161c2e629c78f1ecd8c6e4c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/364537
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:32:11 +00:00
Robert Griesemer
3c00a2839a cmd/compile/internal/types2: return an error from Instantiate on incorrect len(targs)
This CL is a clean port of CL 363635 from go/types to types2.

Updates #47916

Change-Id: Ib46758435c31ad9a6a4a63f552503d5afa66b5c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/364534
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:32:05 +00:00
Robert Griesemer
2f937d9bfc cmd/compile/internal/types2: add a test for Context deduplication of hash collisions
This CL is a clean port of CL 363517 from go/types to types2,
with the exception that types_test.go was not removed because
it's still needed to set a types2-specific test flag.

Change-Id: I12177866537c0f95f3fa36fa0f4aa02016609ca9
Reviewed-on: https://go-review.googlesource.com/c/go/+/364494
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:32:02 +00:00
Robert Griesemer
1c13b58aba cmd/compile/internal/types2: rename types.context to types.environment
This CL is a clean port of CL 363176 from go/types to types2.

It also includes a minor adjustment to a field access in go/types
to match types2 in that respect.

Change-Id: If33fc7e68372b12d61d06b75dd9f7c0715b57bc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/364474
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:31:55 +00:00
Robert Griesemer
9c60a09689 cmd/compile/internal/types2: don't set a Config.Context if none is provided
This CL is a clean port of CL 363175 from go/types to types2.

Change-Id: I149789be07c0ca7ddef7bfaa4ea9507778a63775
Reviewed-on: https://go-review.googlesource.com/c/go/+/364454
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:31:50 +00:00
Robert Griesemer
633d8c120b cmd/compile/internal/types2: when type hashing, canonicalize interfaces
This CL is a clean port of CL 363115 from go/types to types2.

Change-Id: Ic2bd9388c57ffa02e75ab136d952e3ab49eb9018
Reviewed-on: https://go-review.googlesource.com/c/go/+/364394
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:31:45 +00:00
Robert Griesemer
489f58779c cmd/compile/internal/types2: when type hashing, use placeholders for type parameters
This is a port of CL 363114 from go/types to types2 with a temporary
work-around in tparamIndex to avoid a crash with the unified build
and test/typeparam/setsimp.go.

Change-Id: Id4805385f21c95b461911b246fb47ee278a84ac9
Reviewed-on: https://go-review.googlesource.com/c/go/+/364336
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:31:40 +00:00
Robert Griesemer
a17a21c190 cmd/compile/internal/types2: deduplicate signatures with the context
This CL is a mostly clean port of CL 362801 from go/types to types2.
It deviates from go/types in some of the testing code because types2
already had made some of the changes.

It also re-introduces some empty lines that got lost in earlier CLs.

Change-Id: I0bebd68f0880fac61631a5d0c323a9f8ce853ac6
Reviewed-on: https://go-review.googlesource.com/c/go/+/364335
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:31:35 +00:00
Robert Griesemer
fceca2c0f1 cmd/compile/internal/types2: add a test for argument error unwrapping
This CL is a clean port of CL 351338 from go/types to types2.

Change-Id: I7fd0e5a447bf51cb359e71731c2f9b95e3960da6
Reviewed-on: https://go-review.googlesource.com/c/go/+/364536
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:31:29 +00:00
Robert Griesemer
f384c707ac cmd/compile/internal/types2: tweaks to ArgumentError to be more idiomatic
This CL is a clean port of CL 351335 from go/types to types2.

Updates #47916

Change-Id: Idc377fb71d480a51d5e93a348f3a880346011974
Reviewed-on: https://go-review.googlesource.com/c/go/+/364535
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 04:31:22 +00:00
Than McIntosh
3d7cb23e3d cmd/compile: emit definition of 'any' when compiling runtime
Include the predefined type 'any' in the list of other important
predefined types that are emitted when compiling the runtime package
(uintptr, string, etc).

Fixes #49619.

Change-Id: I4a851ba2f302fbc3a425e65daa325c6bf83659da
Reviewed-on: https://go-review.googlesource.com/c/go/+/364377
Trust: Than McIntosh <thanm@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-11-17 01:56:19 +00:00
Josh Bleecher Snyder
a2b8231b91 runtime: remove defer test log spam
This appears to be leftover debugging
from CL 356011.

Change-Id: Ieeda0b7e297e0cb943827b28644135e6cad12e3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/364555
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-17 00:02:01 +00:00
Keith Randall
01b6cf09fc runtime: check GOAMD64 compatibility after setting up TLS
We need TLS set up to be able to print an error without crashing.

Fixes #49586
Update #45453

Change-Id: I97f0efcd716a8dca614e82ab73f2d855b7277599
Reviewed-on: https://go-review.googlesource.com/c/go/+/364174
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <martin@golang.org>
Trust: Martin Möhrmann <martin@golang.org>
Trust: Keith Randall <khr@golang.org>
2021-11-16 23:52:13 +00:00
jiahua wang
5e59d6ebd1 sort: improve sort documentation
Fixes #48527

Change-Id: Ib5df0819cbcd5c2e4f03bda841871d237af96b19
Reviewed-on: https://go-review.googlesource.com/c/go/+/351336
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-16 23:13:41 +00:00
Michael Pratt
f659183972 os/exec: avoid NewFile on unknown FDs
exec_test.go's init function uses os.NewFile(fd) + f.Stat as a portable
mechanism to determine if an FD is in use.

Unfortunately, the current use is racy: if an unused FD becomes used
between NewFile and f.Close, then we will unintentionally close an FD we
do not use.

We cannot simply drop Close, as the finalizer will close the FD. We
could hold all of the os.Files in a global for the lifetime of the
process, but the need for such a hack is indicative of the larger
problem: we should not create an os.File for an FD that we do not own.

Instead, the new fdtest.Exists provides a helper that performs the
equivalent of fstat(2) on each OS to determine if the FD is valid,
without using os.File.

We also reuse this helper on a variety of other tests that look at open
FDs.

Fixes #49533

Change-Id: I36e2bdb15f271ab01e55c18db6564271995a15af
Reviewed-on: https://go-review.googlesource.com/c/go/+/364035
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-16 19:41:37 +00:00
Alessandro Arzilli
6c36c332fe debug/pe,debug/macho: add support for DWARF5 sections
Adds the same logic used in debug/elf to load DWARF5 sections.

Fixes #49590

Change-Id: Iee05b9927a6f521842b330eab8942ade3fc2bd86
Reviewed-on: https://go-review.googlesource.com/c/go/+/363895
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
2021-11-16 18:36:59 +00:00
Michael Matloob
40effca7a1 cmd: pull in golang.org/x/mod@3a5865c
This change updates the cmd module's requirement on x/mod and vendors in
the changes.

This pulls in the following changes into our vendored copy of x/mod:
golang.org/cl/351319: module: accept trailing slash in MatchPrefixPattern
golang.org/cl/353749: semver: remove unused err field
golang.org/cl/355630: x/mod: update requirement on x/crypto
golang.org/cl/359412: modfile: rename directory directive to use

Changes have been made in cmd/go renaming all uses of directory to use
and fixing references to functions in x/mod/modfile to account for the
changes in the last of thse CLs.

For #45713

Change-Id: I9121d08f6e6b11838bca50e6cbd756baeeae867b
Reviewed-on: https://go-review.googlesource.com/c/go/+/364114
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>
2021-11-16 17:32:23 +00:00