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

Closed
dominikh opened this issue Apr 27, 2016 · 7 comments
Closed

cmd/compile: off-by-many in line number reported for compile error #15459

dominikh opened this issue Apr 27, 2016 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dominikh
Copy link
Member

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
Copy link
Member

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
Copy link
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 The path to resolution is known, but the work has not been done. 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
Copy link
Contributor

Reproduces on tip as of May 2, 2017.

@griesemer
Copy link
Contributor

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
Copy link
Contributor

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

@gopherbot
Copy link

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

@griesemer
Copy link
Contributor

The errors are now reported at the correct location with Go 1.18. Closing.

@golang golang locked and limited conversation to collaborators Jun 23, 2023
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

9 participants