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

Comments

Projects
None yet
5 participants
@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

This comment has been minimized.

Copy link
Contributor

rsc commented Nov 27, 2013

Comment 1:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Dec 4, 2013

Comment 2:

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

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added repo-main.

@davecheney

This comment has been minimized.

Copy link
Contributor

davecheney commented Feb 4, 2014

Comment 4:

Labels changed: removed priority-triage.

Status changed to Accepted.

@evankroske

This comment has been minimized.

Copy link

evankroske commented Aug 8, 2014

Comment 5:

I'll take this one.
@evankroske

This comment has been minimized.

Copy link

evankroske commented Aug 14, 2014

Comment 6:

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

This comment has been minimized.

Copy link

gopherbot commented Oct 22, 2014

Comment 7:

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

This comment has been minimized.

Copy link

evankroske commented Dec 22, 2014

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc removed release-none labels 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.