-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: compiler errors should quote user-provided names where they are used "in sentence" of an error message #65790
Comments
Fair enough. We've been trying to avoid "punctuation" but it probably will be clearer to quote user-provided names (at least in some cases like this). |
Change https://go.dev/cl/565518 mentions this issue: |
Use quotes to wrap user-supplied token in the syntax error message. Updates #65790 Change-Id: I631a63df4a6bb8615b7850a324d812190bc15f30 GitHub-Last-Rev: f291e1d GitHub-Pull-Request: #65840 Reviewed-on: https://go-review.googlesource.com/c/go/+/565518 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Testdata is called testdata/issue65970.go while this issue is #65790 |
@fukanchik Thanks for pointing this out. Will fix. |
Change https://go.dev/cl/567875 mentions this issue: |
Leaving this issue open to review other locations (such as the type checker) where a name is used within an error sentence and where it may be confusing. |
Follow-up on CL 565518 which addressed issue #65790 but added testdata/issue65970.go instead of testdata/issue65790.go. Rename that file to match the issue. For #65790. Change-Id: I647c297286355137fa950fb6722e31ae4340393b Reviewed-on: https://go-review.googlesource.com/c/go/+/567875 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change https://go.dev/cl/571396 mentions this issue: |
Change https://go.dev/cl/589118 mentions this issue: |
In an attempt to address issue #65790 (confusing error messages), quoting of names was introduced for some (but not all) names used in error messages. That CL solved the issue at hand at the cost of extra punctuation (the quotes) plus some inconsistency (not all names were quoted). This CL removes the quoting again in favor or adding a qualifying noun (such as "name", "label", "package", "built-in" etc.) before a user- specified name where needed. For instance, instead of invalid argument to `max' we now say invalid argument to built-in max There's still a chance for confusion. For instance, before an error might have been `sadly' not exported by package X and now it would be name sadly not exported by package X but adverbs (such as "sadly") seem unlikely names in programs. This change touches a lot of files but only affects error messages. Fixes #67685. Change-Id: I95435b388f92cade316e2844d59ecf6953b178bc Reviewed-on: https://go-review.googlesource.com/c/go/+/589118 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Go version
go version devel go1.23-4a7f3ac8eb Sat Feb 10 02:14:22 2024 +0000 linux/amd64
Output of
go env
in your module/workspace:What did you do?
https://go.dev/play/p/cUZM3KyGHda
What did you see happen?
What did you expect to see?
"status" quoted as a user provided token, separating it from compiler status.
from #65788
cc @golang/compiler
The text was updated successfully, but these errors were encountered: