-
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: method expressions are misprinted #43428
Comments
We've printed the |
@ianlancetaylor Thanks, that sounds believable. You aren't suggesting cmd/compile should continue printing it incorrectly though, are you? In case it wasn't clear, the linker symbols used for pointer-receiver methods (including as they appear in runtime stack traces) are unchanged on dev.regabi; and while I believe the parentheses are superfluous there, I don't intend to remove them either. This issue is only about how method expressions are printed in Go-syntax compiler diagnostics, like error messages and go/types correctly prints |
Change https://golang.org/cl/280735 mentions this issue: |
Change https://golang.org/cl/280873 mentions this issue: |
OTYPE and OMETHEXPR were missing from OpPrec. So add them with the same precedences as OT{ARRAY,MAP,STRUCT,etc} and ODOT{,METH,INTER,etc}, respectively. However, ODEREF (which is also used for pointer types *T) has a lower precedence than other types, so pointer types need to be specially handled to assign them their correct, lower precedence. Incidentally, this also improves the error messages in issue15055.go, where we were adding unnecessary parentheses around the types in conversion expressions. Thanks to Cuong Manh Le for writing the test cases for #43428. Fixes #43428. Change-Id: I57e7979babe3ed9ef8a8b5a2a3745e3737dd785f Reviewed-on: https://go-review.googlesource.com/c/go/+/280873 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
cmd/compile now prints diagnostics using Go syntax for method expressions on dev.regabi. |
On the dev.regabi branch, the error message for this source file:
mentions
*bytes.Buffer.Len
. That's incorrect: it should be(*bytes.Buffer).Len
, as it appears in the source.(I suspect this is related to the ir/fmt.go changes in 4629f6a. Though it turns out we're printing it incorrectly even on master, where it prints as
bytes.(*Buffer).Len
.)/cc @cuonglm
The text was updated successfully, but these errors were encountered: