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: misleading error for embedded struct field of type parameter #39774

Closed
bcmills opened this issue Jun 23, 2020 · 3 comments
Closed

cmd/go2go: misleading error for embedded struct field of type parameter #39774

bcmills opened this issue Jun 23, 2020 · 3 comments

Comments

@bcmills
Copy link
Member

@bcmills bcmills commented Jun 23, 2020

https://go2goplay.golang.org/p/596K-mmE-Jm was an attempt to define a generic test case equivalent to https://play.golang.org/p/f8yMpNN3aDn:

package main

type I interface{}

type S(type T) struct {
	*T
}

func main() {
	_ = S(I){}
}

I did not expect https://go2goplay.golang.org/p/596K-mmE-Jm to compile, but the error message that it gives seems wrong:

# play
./prog.go2:6: undefined: T

compared with

./prog.go:6:3: embedded type cannot be a pointer to interface

for the non-generic version.

I expected the go2go version to instead produce some sort of error message referring to the fact that T could be an interface type.

@cagedmantis cagedmantis added this to the Unreleased milestone Jun 24, 2020
@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Jun 24, 2020

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 24, 2020

Change https://golang.org/cl/239702 mentions this issue: [dev.go2go] go/go2go: update name of embedded pointer to instantiation

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 24, 2020

Thanks. Fixed on dev.go2go branch.

gopherbot pushed a commit that referenced this issue Jun 24, 2020
Fixes #39774

Change-Id: Icb2948ae19e06a3766e7edb01ef40de50e7aca7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/239702
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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