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: allows multiple-value in switch and case #11687

Closed
dvyukov opened this issue Jul 12, 2015 · 1 comment
Closed

go/types: allows multiple-value in switch and case #11687

dvyukov opened this issue Jul 12, 2015 · 1 comment
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 12, 2015

gotype successfully compiles the following program:

package n

func f() (int, int) {
    return 0, 0
}

func g() {
    switch f() {
    default:
    //case f():
    }
}

gc says:

go.go:8: multiple-value f() in single-value context

which looks like the right thing.

Also if you uncomment the case, gotype says:

go.go:10:7: cannot compare f() == f() (operator == not defined for (int, int))

gotype should reject f() in switch case at earlier stage and say something along the lines of the gc error message (the issue is not with comparison, it is with multiple-value in single-value context).

on commit af81789

@dvyukov dvyukov changed the title go/type: allows multiple-value in switch and case go/types: allows multiple-value in switch and case Jul 12, 2015
@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 12, 2015
@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Aug 22, 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