1126bbb82a
The parser was returning the indexed operand when a slice or index or instance expression was missing any index arguments (as in the expression `a[]`). This can result in returning an *ast.Ident for the LHS of the (invalid) assignment `a[] = ...` -- in this case parsing the LHS as just `a`. Unfortunately, as the indexed operand `a` has already been resolved, this results in a panic for duplicate resolution. Fix this by instead returning an ast.BadExpr. This can suppress some subsequent errors from the typechecker, but those errors may or may not be correct anyway. Other interpretations, such as an *ast.IndexExpr with bad or missing X, run into potential misinterpretations downstream (both caused errors in go/types and/or gopls). Fixes #44504 Change-Id: I5ca8bed4a1861bcc7db8898770b08937110981d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/295151 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> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
favicon.ico | ||
LICENSE | ||
PATENTS | ||
README.md | ||
robots.txt | ||
SECURITY.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 3.0 Attributions 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://golang.org/dl/.
After downloading a binary release, visit https://golang.org/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://golang.org/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://golang.org/doc/contribute.html.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.