1
0
mirror of https://github.com/golang/go synced 2024-11-17 15:54:39 -07:00
Commit Graph

49106 Commits

Author SHA1 Message Date
Cuong Manh Le
d5f6ba943c [dev.typeparams] test: add regression test for go/defer wrapper
CL 330330 moved logic for wrapping go/defer from order to esacpe
analysis. It introduced a bug involves go/defer statement with ABI0
functions.

Consider this following code:

	package p

	//go:cgo_unsafe_args
	func g(*int) (r1 struct{}) {
		return
	}

	func f() {
		defer g(new(int))
	}

g is a cgo-like generated function with ABI0. While compiling g, we set
the offset per ABI0.

The function f is rewritten into:

	func f() {
		_0, _1 := g, new(int)
		defer func() { _0(_1) }()
	}

The temporary _0 hold function value with the same type as g, but with
class PAUTO. Thus ssagen/ssa.go:state.call cannot handle it and use
ABIDefault to set the offset, causes the offset of r1 changed

CL 330332 intended to optimize code generated for wrapping function, by
rewriting the wrapper function into:

	func f() {
		_0 := new(int)
		defer func() { g(_0) }()
	}

So it fixed the bug unintentionally.

This CL add regression test for this bug, and also add a comment to
explain while not wrapping declared function is important.

Updates #47227

Change-Id: I75c83d1d9cc7fd4699e6b218a295d0c0a10ef471
Reviewed-on: https://go-review.googlesource.com/c/go/+/334882
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>
2021-07-21 00:01:12 +00:00
Matthew Dempsky
6a931673f0 [dev.typeparams] cmd/compile: add base.Assertf{,At} functions
We have almost 200 uses of the "assert" helper functions in noder and
typecheck. Clearly the tiny bit of extra convenience of writing a
one-line assertion rather than an if+panic is helpful, so we might as
well add functions for this to base itself so that it's easier to
write more informative error messages.

Change-Id: I06e2db2f0455af063937b25a53ca42f9413cf496
Reviewed-on: https://go-review.googlesource.com/c/go/+/336050
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-07-20 23:11:40 +00:00
Matthew Dempsky
e4994e71fb [dev.typeparams] all: merge master (c8f4e61) into dev.typeparams
Conflicts:

- src/runtime/internal/sys/zgoarch_386.go
- src/runtime/internal/sys/zgoarch_amd64.go
- src/runtime/internal/sys/zgoarch_arm.go
- src/runtime/internal/sys/zgoarch_arm64.go
- src/runtime/internal/sys/zgoarch_arm64be.go
- src/runtime/internal/sys/zgoarch_armbe.go
- src/runtime/internal/sys/zgoarch_mips.go
- src/runtime/internal/sys/zgoarch_mips64.go
- src/runtime/internal/sys/zgoarch_mips64le.go
- src/runtime/internal/sys/zgoarch_mips64p32.go
- src/runtime/internal/sys/zgoarch_mips64p32le.go
- src/runtime/internal/sys/zgoarch_mipsle.go
- src/runtime/internal/sys/zgoarch_ppc.go
- src/runtime/internal/sys/zgoarch_ppc64.go
- src/runtime/internal/sys/zgoarch_ppc64le.go
- src/runtime/internal/sys/zgoarch_riscv.go
- src/runtime/internal/sys/zgoarch_riscv64.go
- src/runtime/internal/sys/zgoarch_s390.go
- src/runtime/internal/sys/zgoarch_s390x.go
- src/runtime/internal/sys/zgoarch_sparc.go
- src/runtime/internal/sys/zgoarch_sparc64.go
- src/runtime/internal/sys/zgoarch_wasm.go

  On dev.typeparams, CL 328336 moved these files to internal/goarch;
  whereas on master, CL 333909 reserved GOARCH=loong64. For this CL,
  I resolved the conflict by simply running "go generate internal/goarch".

Merge List:

+ 2021-07-19 c8f4e6152d spec: correct example comment in Conversions from slice to array
+ 2021-07-19 1d91551b73 time: correct typo in documentation for UnixMicro
+ 2021-07-19 404127c30f cmd/compile: fix off-by-one error in traceback argument counting
+ 2021-07-19 6298cfe672 cmd/compile: fix typo in fatal message of builtinCall
+ 2021-07-19 49402bee36 cmd/{compile,link}: fix bug in map.zero handling
+ 2021-07-18 a66190ecee test/bench/go1: fix size for RegexpMatchMedium_32
+ 2021-07-18 650fc2117a text/scanner: use Go convention in Position doc comment
+ 2021-07-16 aa4e0f528e net/http:  correct capitalization in cancelTimeBody comment
+ 2021-07-15 0941dbca6a testing: clarify in docs that TestMain is advanced
+ 2021-07-15 69728ead87 cmd/go: update error messages in tests to match CL 332573
+ 2021-07-15 c1cc9f9c3d cmd/compile: fix lookup package of redeclared dot import symbol
+ 2021-07-15 21a04e3335 doc/go1.17: mention GOARCH=loong64
+ 2021-07-14 2b00a54baf go/build, runtime/internal/sys: reserve GOARCH=loong64
+ 2021-07-14 60ddf42b46 cmd/go: change link in error message from /wiki to /doc.
+ 2021-07-13 d8f348a589 cmd/go: remove a duplicated word from 'go help mod graph'
+ 2021-07-12 a98589711d crypto/tls: test key type when casting
+ 2021-07-12 cfbd73ba33 doc/go1.17: editing pass over the "Compiler" section
+ 2021-07-09 ab4085ce84 runtime/pprof: call runtime.GC twice in memory profile test

Change-Id: I1490a4c7e4c560659c21a4eb67d243f35d1f908e
2021-07-20 14:34:09 -07:00
Ian Lance Taylor
9e26569293 cmd/go: don't add C compiler ID to hash for standard library
No test because a real test requires installing two different compilers.

For #40042
For #47251

Change-Id: Iefddd67830d242a119378b7ce20be481904806e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/335409
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>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-07-20 20:23:41 +00:00
Benny Siegert
d568e6e075 runtime/debug: skip TestPanicOnFault on netbsd/arm
This test has been failing since the builder was updated to
NetBSD 9. While the issue is under investigation, skip the test
so that we do not miss other breakage.

Update issue #45026

Change-Id: Id083901c517f3f88e6b4bc2b51208f65170d47a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/335909
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-20 19:54:36 +00:00
Piers
c8f4e6152d spec: correct example comment in Conversions from slice to array
Fixes #47280

Change-Id: I78a8d235949b4878c7f075ac4ca37700e7e6c31c
GitHub-Last-Rev: 067f96eeb2
GitHub-Pull-Request: golang/go#47282
Reviewed-on: https://go-review.googlesource.com/c/go/+/335470
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Than McIntosh <thanm@google.com>
2021-07-19 21:59:24 +00:00
helloPiers
1d91551b73 time: correct typo in documentation for UnixMicro
Fixes #47283.

Change-Id: Ibdc35433d22be3caa70197b6a95c66999812a16a
GitHub-Last-Rev: 75962b0294
GitHub-Pull-Request: golang/go#47284
Reviewed-on: https://go-review.googlesource.com/c/go/+/335549
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
2021-07-19 21:56:09 +00:00
Cherry Mui
404127c30f cmd/compile: fix off-by-one error in traceback argument counting
For traceback argument printing, we want to print at most 10
words, then print "..." if there are still more args and/or
fields. The current code has off-by-one error that for 11
non-aggregate typed args, it prints the first 10 but without the
"...". Also, for aggregate-typed args, in some cases it may print
an extra "..." when there is actually no more fields.

The problem for this is that visitType return false (meaning not
to continue visiting) if it reaches the limit anywhere during the
recursive visit. It doesn't distinguish whether it has printed
anything for the current arg. If it reaches the limit before it
prints anything, it means that we're visiting the extra arg/field,
so the caller should print "..." and stop. If it prints
something then reaches the limit, however, the caller should keep
going, and only print "..." at the next iteration when there is
actually an extra arg/field. This CL does so.

Fixes #47159.

Change-Id: I93fc25b73ada2b5a98df780c45e5b0c9565dc2fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/334710
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-07-19 18:00:46 +00:00
Rob Findley
c6d3d0b0ad [dev.typeparams] go/types: fix the type parameter index in applyTypeFunc
We should preserve type parameter indices when transforming them using
applyTypeFunc.

Change-Id: Ib75f5cf1a146bd7e6850368fa954c1affcba3ad1
Reviewed-on: https://go-review.googlesource.com/c/go/+/327269
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-07-19 17:42:35 +00:00
Leonard Wang
6298cfe672 cmd/compile: fix typo in fatal message of builtinCall
Change-Id: I523d5fd810b82154a204670d46fc250a0fc66791
Reviewed-on: https://go-review.googlesource.com/c/go/+/333849
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-19 17:27:58 +00:00
Rob Findley
6bf2667d4e [dev.typeparams] go/types: more consistent handling of predeclared "any"
This is a port of CL 334911 to go/types.

Change-Id: I2cafdc76cb4d06ba82188c530f35952c1f77d292
Reviewed-on: https://go-review.googlesource.com/c/go/+/335569
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-07-19 17:20:27 +00:00
Rob Findley
7e714f448e [dev.typeparams] go/types: embedding stand-alone type parameters is not permitted
This is a port of CL 334151 to go/types.

Fixes #47127

Change-Id: I57d69c498d2649a9e1657559e4c0271333096c88
Reviewed-on: https://go-review.googlesource.com/c/go/+/335082
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-07-19 17:09:54 +00:00
Rob Findley
82f875d735 [dev.typeparams] go/types: fix generic type indirection
This is a port of CL 333890 to go/types.

Change-Id: I8ee20f405dad98083bb5e91636044d132a95d909
Reviewed-on: https://go-review.googlesource.com/c/go/+/335081
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-07-19 17:09:27 +00:00
Rob Findley
62f6f130fe [dev.typeparams] go/types: interface identity must consider full type set
This is a port of CL 333889 to go/types.

Change-Id: I66cefb81a33f4677efc18c1ca923ded374a87f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/335080
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-07-19 17:09:20 +00:00
Rob Findley
baeabf3b36 [dev.typeparams] go/types: cleanups around receiver type checks
This is a port of CL 333770 to go/types, adjusted for the error
reporting API and to not support compiler error messages. An error
message changed (to 'invalid receiver type' from just 'invalid
receiver'), so a test had to be adjusted.

Change-Id: I166e8831d8c9f98ebfb0270fe5221586fc112825
Reviewed-on: https://go-review.googlesource.com/c/go/+/335079
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-07-19 17:09:14 +00:00
Rob Findley
b3d91e3a24 [dev.typeparams] go/types: implement delete(m, k) where m is of type parameter type
This is a port of CL 333729 to go/types.

Change-Id: I8682f549a7a15124b1b338f8c73e83a57d138368
Reviewed-on: https://go-review.googlesource.com/c/go/+/335078
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-07-19 17:08:59 +00:00
Rob Findley
cf7e66b7d4 [dev.typeparams] go/types: implement close(ch) where ch is of type parameter type
This is a port of CL 333713 to go/types.

Change-Id: I517f52592f65cc76e11a12d9148b20c12d9e3e81
Reviewed-on: https://go-review.googlesource.com/c/go/+/335077
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-07-19 17:08:53 +00:00
Rob Findley
19b4142f24 [dev.typeparams] go/types: implement ch <- x where ch is of type parameter type
This is a port of CL 333712 to go/types, adjusted for the different
error reporting API and to position errors on the arrows.

Fixes #43671

Change-Id: I7d2de249e86d272c89a046f60e632e75848ff865
Reviewed-on: https://go-review.googlesource.com/c/go/+/335076
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-07-19 17:08:45 +00:00
Rob Findley
d6d7f8458e [dev.typeparams] go/types: implement <-ch where ch is of type parameter type
This is a port of CL 333709 to go/types, adjusted for the different
error API.

Fixes #43671

Change-Id: Ifd340149bfbcabe401cec74398cb83f2ae812e51
Reviewed-on: https://go-review.googlesource.com/c/go/+/335075
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-07-19 17:08:29 +00:00
Rob Findley
796ac6d5f2 [dev.typeparams] go/types: move methods on *Named into named.go
This is a port of CL 333671 to go/types.

Change-Id: Ic2f66b49f1db68fb93d5095131733e99a37b9cbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/335074
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-07-19 17:07:41 +00:00
Rob Findley
22f39ba208 [dev.typeparams] go/types: use InstantiateLazy to create instance types (cleanup)
This is a port of CL 333669 to go/types, adjusted for the position and
IndexExpr APIs, and excluding the noder changes.

Change-Id: I3ac4bbf271947c3cf80ab04c462a91657316f4fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/335073
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-07-19 17:07:35 +00:00
Rob Findley
4a72be87b3 [dev.typeparams] go/types: move instantiation code to instantiate.go (cleanup)
This is a port of CL 333589 to go/types.

Change-Id: Ib9fb1b09e10c400e62d20b55ff0558f3a92fc0eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/335072
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-07-19 17:07:28 +00:00
Rob Findley
41ff0aac13 [dev.typeparams] go/types: replace types2.Instantiate with Checker.Instantiate
This is a partial port of CL 333569 containing just changes to go/types.
Changes to the importer wil be made in a separate CL.

Change-Id: I9383e260b76402875ca6eb23c4478a6a3e8c1f0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/335071
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-07-19 16:51:16 +00:00
Rob Findley
9e147c55b7 [dev.typeparams] go/types: update TypeParam APIs to match types2
This is a partial port of CL 323029, consisting only of changes to
go/types. Changes to the importer will be made in a separate CL.

Change-Id: I3b300f5e8f4df36c2c87e3f164705cd3c36218ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/335145
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-07-19 15:50:51 +00:00
Rob Findley
22a38ba5ca [dev.typeparams] go/types: remove unnecessary guard from NewInterfaceType
This is a partial port of CL 322609, containing only changes to
go/types. Importer changes will be made in a separate CL.

Change-Id: I50af3c1ed5e949bb28a3462d717c0eb29a5f31ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/335144
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-07-19 15:50:21 +00:00
Rob Findley
b96f1b9419 [dev.typeparams] go/types: add some missing APIs for the importer
This is a partial port of CL 319930, containing only changes to
go/types. Importer changes will be made in a separate CL.

The TypeParams APIs are left unexported for now; they will be exported
when they are needed.

Change-Id: I74bd246d4c174cb38f8360d921c733fa03900eab
Reviewed-on: https://go-review.googlesource.com/c/go/+/335143
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-07-19 15:50:07 +00:00
Rob Findley
43ad1ffa99 [dev.typeparams] go/types: recursive substitution must terminate (bug fix)
This is a port of CL 333383 to go/types.

Change-Id: I7ff68116cbe63337dbcc834c473a2a5588274e36
Reviewed-on: https://go-review.googlesource.com/c/go/+/335115
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-07-19 15:49:58 +00:00
Rob Findley
c7c13ae432 [dev.typeparams] go/types: use scope numbers to identify local types
This is a port of CL 333192 to go/types.

Change-Id: I12fd6b682d40c4d30b9ac0e87c463843cf5030d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/335114
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-07-19 15:49:47 +00:00
Rob Findley
ccf95f17dd [dev.typeparams] go/types: support local defined types
This is a port of CL 327170 to go/types. Tests were not ported; they can
be added later.

Change-Id: Ic9fd681ac06dd187c1715efaf882b11353bc395a
Reviewed-on: https://go-review.googlesource.com/c/go/+/335113
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-07-19 15:49:09 +00:00
Rob Findley
76b39959f4 [dev.typeparams] go/types: don't permit method calls on ptr to type parameter receivers
This is a port of CL 332609 to go/types.

Change-Id: I3482ea1b97bc7101b987ef312cd6cade80a5843f
Reviewed-on: https://go-review.googlesource.com/c/go/+/335112
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-07-19 15:48:55 +00:00
Than McIntosh
49402bee36 cmd/{compile,link}: fix bug in map.zero handling
In CL 326211 a change was made to switch "go.map.zero" symbols from
non-pkg DUPOK symbols to hashed symbols. The intent of this change was
ensure that in cases where there are multiple competing go.map.zero
symbols feeding into a link, the largest map.zero symbol is selected.
The change was buggy, however, and resulted in duplicate symbols in
the final binary (see bug cited below for details). This duplication
was relatively benign for linux/ELF, but causes duplicate definition
errors on Windows.

This patch switches "go.map.zero" symbols back from hashed symbols to
non-pkg DUPOK symbols, and updates the relevant code in the loader to
ensure that we do the right thing when there are multiple competing
DUPOK symbols with different sizes.

Fixes #47185.

Change-Id: I8aeb910c65827f5380144d07646006ba553c9251
Reviewed-on: https://go-review.googlesource.com/c/go/+/334930
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-07-19 13:27:46 +00:00
Dan Scales
9b85985d36 [dev.typeparams] Separate out gcshape types that are instantiated types
Distinguish the gcshape of all top-level instantiated type from normal
concrete types, even if they have the exact same underlying "shape",
because in a function instantiation, any method call on this type arg
will be a generic method call (requiring a dictionary), rather than a
direct method call on the underlying type (no dictionary).

So, we add the instshape prefix to the gcshape name for instantiated
types, and we make it a defined type with that name.

Change-Id: I33056269d24f3451a2632a5ce6a481108f533c9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/335169
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-07-19 05:02:24 +00:00
nimelehin
a66190ecee test/bench/go1: fix size for RegexpMatchMedium_32
Change-Id: Idc67abb95248bc010820a89dd6096a2da334e723
GitHub-Last-Rev: ae9014b011
GitHub-Pull-Request: golang/go#47254
Reviewed-on: https://go-review.googlesource.com/c/go/+/335189
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
2021-07-18 21:03:43 +00:00
mehradsadeghi
650fc2117a text/scanner: use Go convention in Position doc comment
Change-Id: Ib872f139af7bfb0a75cc21dace5358fe8fcf2cf0
GitHub-Last-Rev: 8fd5ab01fa
GitHub-Pull-Request: golang/go#47250
Reviewed-on: https://go-review.googlesource.com/c/go/+/335149
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>
2021-07-18 21:00:03 +00:00
Rob Findley
df778e6fd9 [dev.typeparams] go/types: replace optype() with under() in various cases (cleanup)
This is a port of CL 332555 to go/types.

Change-Id: I9b26bba8b605f5bbbd8f0f81fd6651a4a3ff4b57
Reviewed-on: https://go-review.googlesource.com/c/go/+/335111
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-17 01:52:18 +00:00
Rob Findley
e9836fe318 [dev.typeparams] go/types: clean up index expr implementation for type parameters
This is a port of CL 332553 to go/types. The "expr" variable is renamed to
"e" in Checker.indexExpr to be consistent with types2.

Change-Id: I7905bebf2e8dab47256361362b16becf7596cf95
Reviewed-on: https://go-review.googlesource.com/c/go/+/335110
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
2021-07-17 01:38:18 +00:00
Rob Findley
c4cd76fbbb [dev.typeparams] go/types: disallow "free" type parameter as RHS of a type declaration
This is a port of CL 332411 to go/types. methodset_test.go is similarly
updated.

Change-Id: I332b1837a954acc9d3b7e0e2ad2bec3425f088f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/335109
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
2021-07-17 01:35:49 +00:00
Rob Findley
521828091c [dev.typeparams] go/types: move (remaining) type decls into their own files (cleanup)
This is a port of CL 332093 to go/types. A missing comment is added to
named.go, and some TODOs were added to converge on the TypeParam API.

Change-Id: I781a1d0d3fc6c11bb323123e954c106094d998ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/335040
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-07-16 23:35:10 +00:00
Rob Findley
624d152db7 [dev.typeparams] go/types: move Interface type decl into interface.go (cleanup)
This is a port of CL 332092 to go/types.

Change-Id: I9971c49570424368575108832eac0cd978eb3fe6
Reviewed-on: https://go-review.googlesource.com/c/go/+/335039
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-07-16 23:34:53 +00:00
Rob Findley
e12d43866d [dev.typeparams] go/types: move Signature type decl into signature.go (cleanup)
This is a port of CL 332091 to go/types. Notably types.Signature is
missing APIs for RParams. This is left for a later CL, when the API is
finalized.

Change-Id: I70b664d656e8c1e32958a75e1d13eab5f3281bf9
Reviewed-on: https://go-review.googlesource.com/c/go/+/335038
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-07-16 23:34:44 +00:00
Rob Findley
b3e7f23a48 [dev.typeparams] go/types: move Struct type decl into struct.go (cleanup)
This is a port of CL 332090 to go/types.

Change-Id: Idc480374f5efe0e7f34f76f37ffd02a3aef59c67
Reviewed-on: https://go-review.googlesource.com/c/go/+/335037
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-07-16 23:34:35 +00:00
Rob Findley
7c35f5c2fc [dev.typeparams] go/types: rename newTypeSet -> computeTypeSet
This is a port of CL 332089 to go/types.

Change-Id: I39321eaee184c8204bd255b7770a0770ecb25fda
Reviewed-on: https://go-review.googlesource.com/c/go/+/335036
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-07-16 23:34:25 +00:00
Rob Findley
de209e693a [dev.typeparams] go/types: make Interface.obj a *TypeName
This is a straightforward port of CL 332011 to go/types.

Change-Id: I682791886c8496c52094f3688e36934afbd7a241
Reviewed-on: https://go-review.googlesource.com/c/go/+/335035
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-07-16 23:34:15 +00:00
Rob Findley
0f4198b5e2 [dev.typeparams] go/types: delay interface check for type bounds
This is a port of CL 331690 to go/types. It diverges from that CL due to
the different representation of Fields in the AST.

Change-Id: I3ae9ac3a0172dc58ac748f28772d87b00db0732a
Reviewed-on: https://go-review.googlesource.com/c/go/+/335034
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-07-16 23:34:00 +00:00
Rob Findley
5f50a6442e [dev.typeparams] go/internal/typeparams: remove the Enabled guard
Type parameters are now always enabled. Users should guard against type
checking generic code by using the types.Config.GoVersion field.

This cleans up some differences with types2.

Change-Id: Ie3e35a549e456a90a10d6a7e158ff58653cc1394
Reviewed-on: https://go-review.googlesource.com/c/go/+/335033
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-07-16 23:08:28 +00:00
Rob Findley
726ffce659 [dev.typeparams] go/types: "comparable" must not be visible before Go 1.18
This is a straightforward port of CL 331517 to go/types.

Change-Id: Id00761fd5dffb4d09e19f086d18ddc20f11528d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/335032
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-07-16 23:07:17 +00:00
Rob Findley
79955155e9 [dev.typeparams] go/types: move newTypeSet function into typeset.go
This is a straightforward port of CL 331515 to go/types.

Change-Id: I05c687e7dd7a64a8a7815c4483ff7fbb06b37627
Reviewed-on: https://go-review.googlesource.com/c/go/+/335031
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-07-16 23:07:10 +00:00
Rob Findley
fe4f13404d [dev.typeparams] go/types: move embedding positions from Checker to Interface
This is a straightforward port of CL 331514 to go/types, with minor
adjustments for the different position API.

Change-Id: I714b3f1cd5a0e8d249912bb589d456885a87e167
Reviewed-on: https://go-review.googlesource.com/c/go/+/335030
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-07-16 23:05:06 +00:00
Rob Findley
b98b8b9b5b [dev.typeparams] go/types: remove unused *Checker arguments (cleanup)
This is a straightforward port of CL 331512 to go/types. API usage in
methodset.go was also updated.

Change-Id: I6701265c9d2ae40eb9aa0ea5f00c98ce3516edab
Reviewed-on: https://go-review.googlesource.com/c/go/+/335009
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-07-16 23:04:55 +00:00
Rob Findley
fce6290e0a [dev.typeparams] go/types: remove typeparams wrappers and aliases
These wrappers and aliases were necessary when we had different versions
of the API depending on the typeparams build constraint, but now they're
just boilerplate. Remove them.

Notably the documentation for types.Info is restored.

Change-Id: I5363d1d5df47649c2641c03328dfba45b1456278
Reviewed-on: https://go-review.googlesource.com/c/go/+/334895
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-07-16 23:04:45 +00:00