1) Factor out handling of receiver from Checker.funcType into Checker.collectRecv. Analyze the receiver parameter "manually" without resorting to calling Checker.collectParams. The code is more straight-forward and error handling is simpler because constructing the receiver type and variable is all handled in one function. 2) Change Checker.collectParams to collect parameter names and corresponding parameter variables, but do not declare them. Instead return two equal-length slices of parameter names and variables for later declaration. 3) Streamline Checker.funcType into a sequence of simple steps. By declaring the receiver and parameters after type parameters, there is no need for a temporary scope and scope squashing anymore. 4) Simplify Checker.unpackRecv some more: don't strip multiple *'s from receiver type expression because we don't typecheck that expression as a whole later (we don't use collectParams for receiver types anymore). If we have a **T receiver, we need to use *T (one * stripped) as receiver base type expression so that we can report an error later. 5) Remove Checker.recvTParamMap and associated machinery as it is not needed anymore. 6) Remove Scope.Squash/squash as it is not needed anymore. 7) Remove the explicit scope parameter from Checker.collectParams as it is not needed anymore. 8) Minor adjustments to tests: in some cases, error positions have shifted slightly (because we don't use Checker.collectParams to typecheck receivers anymore), and in some cases duplicate errors don't appear anymore (resolves TODOs). Fixes #51343. Change-Id: Ia77e939bb68e2912ef2e4ed68d2a7a0ad605c5ba Reviewed-on: https://go-review.googlesource.com/c/go/+/594740 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> |
||
|---|---|---|
| .github | ||
| api | ||
| doc | ||
| lib/time | ||
| misc | ||
| src | ||
| test | ||
| .gitattributes | ||
| .gitignore | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| PATENTS | ||
| README.md | ||
| SECURITY.md | ||
| codereview.cfg | ||
| go.env | ||
README.md
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 4.0 Attribution license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.