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: autotmp_NNNN variable name in compiler error output #11737

Closed
willfaught opened this issue Jul 16, 2015 · 3 comments
Closed

cmd/compile: autotmp_NNNN variable name in compiler error output #11737

willfaught opened this issue Jul 16, 2015 · 3 comments
Milestone

Comments

@willfaught
Copy link
Contributor

Write code like this:

func F(middleware interface{}) {
    switch middleware {
    case tigertonic.JSONLogged:
        [...]

and get a compiler error like this:

$ go build
# [...]/server
./middleware.go:69: invalid operation: autotmp_0210 == "github.com/rcrowley/go-tigertonic".JSONLogged (operator == not defined on func)
./middleware.go:73: invalid operation: autotmp_0210 == "github.com/rcrowley/go-tigertonic".Logged (operator == not defined on func)

I'm guessing auto-generated variable names aren't meant to be exposed outside the compiler?

@ianlancetaylor
Copy link
Contributor

Which version of Go?

Can you please provide a small, complete, standalone example? That will take less total time than us guessing to try to create a complete example from your code fragment. Thanks.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 16, 2015
@ebfe
Copy link
Contributor

ebfe commented Jul 18, 2015

go version devel +aadd84e Sat Jul 18 01:35:25 2015 +0000 linux/amd64

package main

func f() {}

func s(x interface{}) {
        switch x {
        case f:
        }
}

func main() {
        s(f)
}

./t.go:7: invalid operation: autotmp_0000 == f (operator == not defined on func)

@ianlancetaylor ianlancetaylor changed the title cmd/go: autotmp_NNNN variable name in compiler error output cmd/compile: autotmp_NNNN variable name in compiler error output Jul 18, 2015
@gopherbot
Copy link

CL https://golang.org/cl/17816 mentions this issue.

@rsc rsc closed this as completed in 63a6f30 Dec 16, 2015
@golang golang locked and limited conversation to collaborators Dec 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants