Skip to content

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

Description

@dvyukov

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions