-
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: improve error message when a method expression references ambiguous method name #14321
Comments
FTR, according to the spec, type C really doesn't have method
F because neither of them is promoted. (See #14309.)
so technically gc is correct and there is no ambiguities here.
|
Right. I see now. Thank you. |
@minux after @momchil-velikov's agreement of your explanation, do you think this issue should be closed? |
This is not about whether gc has a bug or not - this is about improving the error message. gc may be technically correct, but a typical user not fluent in the fine points of the spec by heart (really, all of us), is going to scratch his or her head. I think remarking on the ambiguity of the selector in the error message is helpful. Please keep this open. It's not urgent, though. |
It would be nice to say '(type C has ambiguous method F)' instead, in this case. |
CL https://golang.org/cl/41853 mentions this issue. |
Change https://golang.org/cl/106119 mentions this issue: |
In the following program
the
go
compiler issues error messageC.F undefined (type C has no method F)
, whereas the typeC
in fact has a methodF
, even two of them :)gccgo
andgotype
correctly report ambiguous method error.go version devel +76cb265 Sat Feb 13 06:46:47 2016 +0000 linux/amd64
The text was updated successfully, but these errors were encountered: