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/go2go: error when a type parameter name and an interface name are same #39659

hajimehoshi opened this issue Jun 17, 2020 · 1 comment


Copy link

@hajimehoshi hajimehoshi commented Jun 17, 2020

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


Does this issue reproduce with the latest release?


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


What did you do?

package main

type Foo interface{}

func F(type Foo Foo)() {

func main() {

What did you expect to see?

Compilation succeeds, or a better error message?

What did you see instead?

type checking failed for main
prog.go2:5:17: Foo is not an interface
Copy link

@ianlancetaylor ianlancetaylor commented Jun 18, 2020

This is expected behavior. It's a consequence of the fact that within a type parameter list, all type parameters are visible throughout the list ( In (type Foo Foo) the second Foo refers to the first Foo, so it is indeed not an interface type.

CC @griesemer in case he sees a way to get a better error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.