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: off-by-many in line number reported for compile error #15459

Open
dominikh opened this Issue Apr 27, 2016 · 6 comments

Comments

Projects
None yet
9 participants
@dominikh
Member

dominikh commented Apr 27, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version go1.6 linux/amd64
    go version devel +2a889b9 Tue Apr 26 23:40:13 2016 +0000 linux/amd64

  2. What operating system and processor architecture are you using (go env)?
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"

  3. What did you do?
    Compile http://play.golang.org/p/QBYmFtLesr

  4. What did you expect to see?
    Errors on the lines that s1 and s2 are used on:

    ./foo.go:11: cannot use s1 (type string) as type int in argument to foo
    ./foo.go:12: cannot use s2 (type string) as type int in argument to foo
    
  5. What did you see instead?
    Errors on the first argument of the function call:

    ./foo.go:10: cannot use s1 (type string) as type int in argument to foo
    ./foo.go:10: cannot use s2 (type string) as type int in argument to foo
    

This looks similar to #8836 but not quite.

@mdempsky mdempsky self-assigned this Apr 27, 2016

@mdempsky

This comment has been minimized.

Member

mdempsky commented Apr 28, 2016

It is basically the same problem as #8836. In the Node AST, the s1 and s2 identifiers within the call site are replaced with references to the s1 and s2 variable declarations, respectively, so we lose line number information for them. The errors are emitted at line 10 because that's the last line where we do have line number information.

@bradfitz bradfitz added this to the Go1.7 milestone May 4, 2016

@rsc

This comment has been minimized.

Contributor

rsc commented May 17, 2016

@griesemer is looking into a long-term revamp of the front end code. That will address this. I don't think it's worth worrying about before then. Even if the line number is off a little, the error is very clear about the location.

@rsc rsc modified the milestones: Go1.8, Go1.7 May 17, 2016

@quentinmit quentinmit added the NeedsFix label Oct 11, 2016

@quentinmit quentinmit modified the milestones: Go1.8Maybe, Go1.8 Oct 11, 2016

@rsc rsc modified the milestones: Go1.9, Go1.8Maybe Oct 20, 2016

@josharian

This comment has been minimized.

Contributor

josharian commented May 2, 2017

Reproduces on tip as of May 2, 2017.

@griesemer

This comment has been minimized.

Contributor

griesemer commented Jun 6, 2017

Bumping to 1.10 unless @mdempsky sees an easy fix.

@griesemer griesemer modified the milestones: Go1.10, Go1.9 Jun 6, 2017

@mdempsky mdempsky modified the milestones: Go1.10, Go1.11 Nov 29, 2017

@griesemer griesemer assigned griesemer and unassigned mdempsky Jun 5, 2018

@griesemer griesemer modified the milestones: Go1.11, Go1.12 Jun 5, 2018

@odeke-em odeke-em self-assigned this Aug 2, 2018

@griesemer griesemer modified the milestones: Go1.12, Unplanned Oct 22, 2018

@griesemer

This comment has been minimized.

Contributor

griesemer commented Oct 22, 2018

Bumping to unplanned in favor of a more significant overhaul of front-end.

@gopherbot

This comment has been minimized.

gopherbot commented Nov 5, 2018

Change https://golang.org/cl/147379 mentions this issue: cmd/compile: Store original positions for Nodes elements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment