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

go/types: column reporting of "no field or method" seems wrong #24645

Closed
rasky opened this issue Apr 2, 2018 · 3 comments
Closed

go/types: column reporting of "no field or method" seems wrong #24645

rasky opened this issue Apr 2, 2018 · 3 comments
Assignees
Milestone

Comments

@rasky
Copy link
Member

@rasky rasky commented Apr 2, 2018

When typechecking a selector, go/types reports the column corresponding to the begin of the selector expression, rather than name being selected:

       obj[whatever].missing(123)
       ^
       gotype reports here

The compiler instead reports the missing name:

       obj[whatever].missing(123)
                     ^
                     compiler reports here

The compiler version seems preferable, as it better highlights where the error probably lies. For instance, this is how my editor (that uses go/types) highlights a missing method:

screenshot 2018-04-02 20 21 27

I prepared a quick fix and this is how it looks like once go/types matches column info with the compiler:

screenshot 2018-04-02 20 23 06

I will submit a CL soon.

@rasky
Copy link
Member Author

@rasky rasky commented Apr 2, 2018

Loading

@griesemer
Copy link
Contributor

@griesemer griesemer commented Apr 2, 2018

@rasky I have assigned this issue for me simply so it stays on my radar. If you end up with a CL, please assign it to me for review; thanks.

Loading

@griesemer griesemer self-assigned this Apr 2, 2018
@griesemer griesemer added this to the Go1.11 milestone Apr 2, 2018
@gopherbot
Copy link

@gopherbot gopherbot commented Apr 2, 2018

Change https://golang.org/cl/104155 mentions this issue: go/types: fix column reporting of invalid selector names

Loading

@rasky rasky changed the title go/type: column reporting of "no field or method" seems wrong go/types: column reporting of "no field or method" seems wrong Apr 2, 2018
@gopherbot gopherbot closed this in 6903244 Apr 2, 2018
@golang golang locked and limited conversation to collaborators Apr 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants