diff options
| author | Robert Griesemer <gri@golang.org> | 2024-03-13 13:57:08 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-03-18 18:59:40 +0000 |
| commit | dc6a5cfca18320ab41af7c5f64565ec2ba303843 (patch) | |
| tree | 007ba40652504e5da68f2bc4b21ffef91b47d4a2 /src/database | |
| parent | 2e8d84f148c69404b8eec86d9149785a3f4e3e92 (diff) | |
| download | go-dc6a5cfca18320ab41af7c5f64565ec2ba303843.tar.xz | |
go/types, types2: quote user-supplied names in error messages
Use `' quotes (as in `foo') to differentiate from Go quotes.
Quoting prevents confusion when user-supplied names alter
the meaning of the error message.
For instance, report
duplicate method `wanted'
rather than
duplicate method wanted
Exceptions:
- don't quote _:
`_' is ugly and not necessary
- don't quote after a ":":
undefined name: foo
- don't quote if the name is used correctly in a statement:
goto L jumps over variable declaration
Quoting is done with a helper function and can be centrally adjusted
and fine-tuned as needed.
Adjusted some test cases to explicitly include the quoted names.
Fixes #65790.
Change-Id: Icce667215f303ab8685d3e5cb00d540a2fd372ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/571396
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/database')
0 files changed, 0 insertions, 0 deletions
