Skip to content
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 compiler error message when accessing type instead of instance of type #6814

Open
btracey opened this issue Nov 21, 2013 · 8 comments
Milestone

Comments

@btracey
Copy link
Contributor

btracey commented Nov 21, 2013

http://play.golang.org/p/54n3Rs7JHT

If you have a function that has f which is a Foo, and try to reference Foo.Bar instead
of f.Bar, you get the following error message:

prog.go:10: Foo.Bar undefined (type Foo has no method Bar)
 [process exited with non-zero status]

I can see where this is coming from, because it's valid syntax if you're trying to get a
method, but I wonder if there could be a different error message when Foo has the field
Bar as in this case Foo is trying to be used as a value.
@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 1:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 2:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added repo-main.

@davecheney
Copy link
Contributor

Comment 4:

Labels changed: removed priority-triage.

Status changed to Accepted.

@evankroske
Copy link

Comment 5:

I'll take this one.

@evankroske
Copy link

Comment 6:

Waiting on compiler changes of 1.4:
https://groups.google.com/d/msg/golang-dev/daq9U6pEAE8/7OSkog_uNt0J

@gopherbot
Copy link

Comment 7:

CL https://golang.org/cl/152570045 mentions this issue.

@evankroske
Copy link

CL migrated to Gerrit: https://go-review.googlesource.com/#/c/1926/

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gc: improve compiler error message when accessing type instead of instance of type cmd/compile: improve compiler error message when accessing type instead of instance of type Jun 8, 2015
@odeke-em odeke-em self-assigned this Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants