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: missing "declared but not used" error for assignment in closure. #23659

Closed
rmmh opened this issue Feb 2, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@rmmh
Copy link
Contributor

commented Feb 2, 2018

What version of Go are you using (go version)?

go1.10rc1 linux/amd64

Does this issue reproduce with the latest release?

Yes, and with tip. (851e98f)

What operating system and processor architecture are you using (go env)?

Ubuntu 16.04.

What did you do?

Attempting to use go/types to do fast type checking of a large repository reveals a problem:

func a() {
        var x int
        func() {
        	x = 3
        }()
}

Is reported as x declared but not used by go/types, but does not produce an error in the compiler.

Demo: https://play.golang.org/p/oi6haYy6cXt

What did you expect to see?

I expected go/types to return identical type errors as actually compiling.

What did you see instead?

Different errors.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Feb 2, 2018

Dup of #8560?

@rmmh

This comment has been minimized.

Copy link
Contributor Author

commented Feb 2, 2018

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Mar 28, 2018

Closing as dup.

@golang golang locked and limited conversation to collaborators Mar 28, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.