This is a straightforward port of CL 341855 to go/types.
Change-Id: I42a74df7a54f5d03aab31ad75dfeb3d1ba775354
Reviewed-on: https://go-review.googlesource.com/c/go/+/342477
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 is a port of CL 341290 to go/types; SetTArgs is a potentially
error-prone API.
Change-Id: I484e62d71a0e09be1e19f8e63994912a88364eca
Reviewed-on: https://go-review.googlesource.com/c/go/+/342476
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 is a port of CL 340911 to go/types. The new check differs slightly,
due to go/ast storing type parameters on the function type, rather than
declaration. The error was positioned on the function name for
consistency with types2 (and because that's a better position).
Change-Id: Icdfc76cd65fab215139180b710293a0d79709297
Reviewed-on: https://go-review.googlesource.com/c/go/+/342475
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 is a port of CL 340749 to go/types.
Change-Id: I2af602d357486ee2f45b91c11c4b02ec6b58ed38
Reviewed-on: https://go-review.googlesource.com/c/go/+/342474
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 CL contains an assortment of superficial fixes noticed while
self-reviewing the most recent stack of ports. It also makes a couple
adjustments to termlist_test.go, in both go/types and
cmd/compile/internal/types2.
Change-Id: I64c8cda5e1704e86ac11c6ffc86d55248f44ef79
Reviewed-on: https://go-review.googlesource.com/c/go/+/342490
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 partial port of CL 340255 to go/types. Of course we can't
delete Interface.Complete, but make it a no-op.
Completing interfaces is no longer necessary.
Change-Id: Ida3c84cc94713f14a646c7682f5d4ae5339a0faa
Reviewed-on: https://go-review.googlesource.com/c/go/+/342489
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>
Currently, for hidden closures, we always push them to compile queue
during typechecking. If the hidden closure is discarded from the outer
function body during deadcode, any desugaring phase after deadcode won't
be applied to the closure. Thus, some un-expected OPs are passed to
downstream passes, which they can't handle, the compiler goes boom!
To fix this, we keep track of discarded hidden closures during deadcode
pass, and won't compile them then.
Fixes#47712
Change-Id: I078717d5d1f4f2fa39cbaf610cfffbb042e70ceb
Reviewed-on: https://go-review.googlesource.com/c/go/+/342350
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: Matthew Dempsky <mdempsky@google.com>
Calling Getsockname once to fetch the Pid field from the *SockaddrNetlink
is necessary, but this data will remain static for the rest of the netlink
socket's lifetime. Moving this call and type assertion outside of the inner
loops will remove a number of unnecessary system calls.
Change-Id: I7e7e81866af1a31fccdaaf7531efd6cc4cbb8926
Reviewed-on: https://go-review.googlesource.com/c/go/+/336369
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
In the time package, the ticker and timer both send
current time to channel C, so this PR update the comment
to understand them better.
Change-Id: I99846a40bf8ef780bf0062dd84cf721b3b892a1b
GitHub-Last-Rev: 535da54b8e
GitHub-Pull-Request: golang/go#47597
Reviewed-on: https://go-review.googlesource.com/c/go/+/340649
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Without this change, this code is technically in violation of the
unsafe.Pointer rules since the conversion from unsafe.Pointer to uintptr has
to happen when calling into the syscall6 assembly implementation.
Change-Id: I4821f5bf9788c8fa2efeb041f811ed092e07ae74
Reviewed-on: https://go-review.googlesource.com/c/go/+/340949
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Capturing dictionary closure variables is ok.
Fixes#47684
Change-Id: I049c87117915e0c5a172b9665bfac2f91064b2d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/342050
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
When external linking, we are creating an object file, instead of
a executable. The absolute address is irrelevant. The external
linker will set it up. Start at address 0.
Change-Id: I3a2e0b8087b328d5c3144f29ca8ba6311aa39cba
Reviewed-on: https://go-review.googlesource.com/c/go/+/319830
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This template is based on CL 295209 and previous ones like it.
Continue to eagerly include often-used sections, and clarify that
the TODO is about completing the section, or removing if it turns
out not to be needed.
Move the Go 1.17 release notes to x/website, since that's the new
home for past Go release notes as of CL 291711. They're added to
x/website in CL 342089.
For #47694
Updates #44513
Change-Id: I24962eed800d1509bdf71b7d7f819a683eb96f8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/342070
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
This is a port of CL 340254 to go/types, with minor adjustments for
errors and positions.
Change-Id: I49ea1d1de8d6e27484f167b813267615d142d31c
Reviewed-on: https://go-review.googlesource.com/c/go/+/342438
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 straightforward port of CL 340250 to go/types.
Change-Id: I8fc1c78833b5393fb39344fd248529df57870a72
Reviewed-on: https://go-review.googlesource.com/c/go/+/342437
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 339905 to go/types.
Change-Id: I9afac9e84bde6f34bb65c7e3d726986d2c648a91
Reviewed-on: https://go-review.googlesource.com/c/go/+/342436
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 339903 to go/types.
Change-Id: Iaf5fe7321d907df4421128c66cf8c58129eaae8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/342435
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 339899 to go/types. A test assertion is adjusted
to place the 'not enough arguments' error on the ')'.
Change-Id: Ia13eccc66586f9b84a8b99d462bb406d363a3288
Reviewed-on: https://go-review.googlesource.com/c/go/+/342434
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 339897 to go/types. In addition, an error message
that was adjusted in CL 274974 is ported to go/types (CL 274974 was
only considered necessary for compiler compatibility).
Change-Id: Idfe44d759c925f9fed353a2d1898d3d4d8d85452
Reviewed-on: https://go-review.googlesource.com/c/go/+/342433
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 339891 to go/types.
Change-Id: If4d9bbb3ace45bec0f40082dd42ed2dd249100ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/342432
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 339969 to go/types. It differs slightly in
errors.go, due to the differing API.
Change-Id: Ie2bf84ebf312ea3872ee6706615dfc6169a32405
Reviewed-on: https://go-review.googlesource.com/c/go/+/342431
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 straightforward port of CL 339832 to go/types.
Change-Id: Ibcb1b130ea474bbbfe9cb5138170e27b466313cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/342430
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 339831 to go/types.
gcCompatibilityMode is unused, and x/tools/go/types no longer exists, so
delete it.
Change-Id: I886d8c24b7aa6511934ac78549f07a88a18e950b
Reviewed-on: https://go-review.googlesource.com/c/go/+/342429
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>
assignableTo
In CL 338310, assignableTo was altered to walk the constituent types of
TypeParams rather than Unions, but was not also adjusted to use under
rather than optype. This manifested in the port to go/types.
Change-Id: Ie057b96ce93cef204af88b536ea49344c9bc8f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/342409
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 338310 to go/types. It is superficially adjusted
for different error reporting and AST APIs. It also fixes a bug in CL
338310 that only manifests in go/types (TestFixedbugs/issue39755.go2)
due to go/types preserving untyped nil. In that CL, operand.go is
checking if optype is a TypeParam, which can never be the case. A fix
for types2 will be mailed in a separate CL.
Change-Id: Icf3394e74baec536842267d99f7511d25ab32a8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/342331
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 straightforward port of CL 339596 to go/types, differing only
in the package declaration.
Change-Id: If5bf8fd5667bee91b04fdb797702e6045d5fba7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/342330
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>
These ioctls take a pid_t (generally a C integer aka int32) and not an int64 - we
currently get away with this on little endian 64 bit platforms, since the bytes
fall into the correct place, however this breaks on big endian 64 bit platforms
(like openbsd/mips64).
This is the same fix as CL 267605, however for libc based exec.
Updates #36435
Change-Id: I01ae4905cba5e1f8725fa6cb8c35403c511534b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/334881
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
In asmcgocall() we need to switch to the g0 stack if we're not already on
the g0 stack or the gsignal stack. The prefered way of doing this is to
check gsignal first, then g0, since if we are going to switch to g0 we will
need g0 handy (thus avoiding a second load).
Rewrite/reorder 386 and amd64 to check gsignal first - this shaves a few
assembly instructions off and makes the order consistent with arm, arm64,
mips64 and ppc64. Add missing gsignal checks to mips, riscv64 and s390x.
Change-Id: I1b027bf393c25e0c33e1d8eb80de67e4a0a3f561
Reviewed-on: https://go-review.googlesource.com/c/go/+/335869
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Do not switch to the g0 stack if we're already running on the signal
stack, otherwise all kind of fun ensues.
Updates #36435
Change-Id: I57f35d75b9ee4f92b997713b4cdd38ce881705e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/334880
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This is required now that defs_openbsd.go has pthread related references.
Updates #36435
Change-Id: I73cdf23eef6aceea6f9b37b7702bdb3b560aa120
Reviewed-on: https://go-review.googlesource.com/c/go/+/334877
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Follow CL 94775 and CL 93655 which removed the (commented-out) usage
of this function on other platforms.
Change-Id: I28e0569d8531d0c09f3caefa7c4eb54fb5bd8a33
Reviewed-on: https://go-review.googlesource.com/c/go/+/334429
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
For #47704.
Change-Id: I09e6f638df0cd456a20a3b68ab55c47bb5b1f555
Reviewed-on: https://go-review.googlesource.com/c/go/+/342370
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>
Change-Id: I141d29bb4adc957de5de1f8ed8867980fd3c8386
Reviewed-on: https://go-review.googlesource.com/c/go/+/342071
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 stanza is no longer necessary now that the typeparams build tag is
not used.
Change-Id: I7bcc4a01e354e5130d50b00895a5b96c25c71502
Reviewed-on: https://go-review.googlesource.com/c/go/+/342153
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>
Fixes#47699
The documentation for CompareAndSwap atomic/value incorrectly labelled the function as CompareAndSwapPointer. This PR fixes that.
Change-Id: I6db08fdfe166570b775248fd24550f5d28e3434e
GitHub-Last-Rev: 41f7870792
GitHub-Pull-Request: golang/go#47700
Reviewed-on: https://go-review.googlesource.com/c/go/+/342210
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Go Bot <gobot@golang.org>
The 'TypeParams' name is too easily confused with the singular
'TypeParam', and does not say anything about what type of collection it
is. We decided that TTuple was not great. TParamList seems OK for now,
though perhaps a better name will emerge.
Change-Id: I5eabdc91b1f666bb4c7ea8acdbebf7c372d19227
Reviewed-on: https://go-review.googlesource.com/c/go/+/341861
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>
Now that we always capture targs when constructing an instance, we no
longer need to pass them via the substMap. This simplifies the code and
resolves a TODO.
Change-Id: I592dccaeb89c7cc31ac037d919137bb762820365
Reviewed-on: https://go-review.googlesource.com/c/go/+/341859
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>
Exposing a synthetic type name for instantiated types is problematic:
there is no way to ensure that type instances are first created in the
same type checking pass, and therefore no guarantee that their
instantiation positions are the same. Even type checking a given package
with different file ordering could result in different positions being
associated with type instances. This is therefore an implementation
detail that we should not expose.
Keep the synthetic type name for accurate error reporting, but hide it
in the API.
Change-Id: I61f0e3ed322e97b157eb1ca316480f5719dcc174
Reviewed-on: https://go-review.googlesource.com/c/go/+/341858
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>
Remove some unnecessary logic from Named.under:
- no need to have special handling for Typ[Invalid]: this is the same
as other cases where the underlying type is resolved.
- use Underlying() to get the loaded and expanded underlying
- no need for special handling of the first iteration
Change-Id: I2029711f51fa9eaaee11debadd55974a1376a980
Reviewed-on: https://go-review.googlesource.com/c/go/+/341857
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>
Instantiation of parameterized types may occur in other packages, so we
need an intrinsic notion of type identity for instances.
Add the natural definition: two instances are identical if their bases
and type arguments are identical.
Type unification was already considering type arguments, but has some
inaccurate logic with respect to objects. This will be addressed in a
follow-up CL.
Change-Id: Ib2ce67c05de65eb302ee588cc40c89c60018da50
Reviewed-on: https://go-review.googlesource.com/c/go/+/341856
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>
Instantiate and InstantiateLazy have the same signature; on first
principles, if Instantiate should work for importers it should be
possible to consolidate these APIs.
This CL does this. In order to make it work, a typMap needs to be
threaded through type expansion to prevent infinite recursion in the
case that the Checker is nil.
Notably, Named types now must be expanded before returning from
Underlying(). This makes Underlying generally unsafe to call while type
checking a package, so a helper function safeUnderlying is added to
provide the previous behavior. This is probably overly conservative at
most call sites, but cleanup is deferred to a later CL.
Change-Id: I03cfb75bea0750862cd6eea4e3cdc875a7daa989
Reviewed-on: https://go-review.googlesource.com/c/go/+/341855
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>
Change-Id: I0f53cc2b845f8a52fece2aaba1445a0ecb9cdc53
Reviewed-on: https://go-review.googlesource.com/c/go/+/341129
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
We use "build" for tests in the main package with a main function.
We use "compile" for tests that are not in the main package.
Change-Id: I9876b55a9e4672277483fd24e69058d439c66658
Reviewed-on: https://go-review.googlesource.com/c/go/+/334329
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>