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: identifier resolved incorrectly #24026

Closed
alandonovan opened this issue Feb 22, 2018 · 2 comments
Closed

go/types: identifier resolved incorrectly #24026

alandonovan opened this issue Feb 22, 2018 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@alandonovan
Copy link
Contributor

The type checker incorrectly resolves the reference in f(0) in the program below to the local variable f declared on the same line, not the package-level function f.

go version devel +a66af7280d Wed Feb 21 21:23:08 2018 +0000 linux/amd64
$ cat a.go
package main

func f(x int) string

func g() {
        f := func() string { return f(0) }
        f()
}
$ go run $GOROOT/src/go/types/gotype.go -- a.go
a.go:6:32: too many arguments
@griesemer griesemer added this to the Go1.11 milestone Feb 22, 2018
@griesemer griesemer added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Feb 22, 2018
@griesemer
Copy link
Contributor

This appears to only happen for short variable declarations; var f = func() { ... f() ... } seems to be ok. So there's at least a temporary work-around.

This bug was likely newly introduced with some of the 1.11 changes for go/types.

@gopherbot
Copy link

Change https://golang.org/cl/96177 mentions this issue: go/types: fix regression with short variable declarations

@golang golang locked and limited conversation to collaborators Feb 22, 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. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants