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
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rasky
Copy link
Member

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 commented Apr 2, 2018

/cc @griesemer

@griesemer
Copy link
Contributor

@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.

@griesemer griesemer self-assigned this Apr 2, 2018
@griesemer griesemer added this to the Go1.11 milestone Apr 2, 2018
@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 2, 2018
@gopherbot
Copy link

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

@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
@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.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants