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
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Contributor

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 the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 24, 2020
@cagedmantis cagedmantis added this to the Unreleased milestone Jun 24, 2020
@cagedmantis
Copy link
Contributor

/cc @griesemer @ianlancetaylor

@gopherbot
Copy link

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

@ianlancetaylor
Copy link
Contributor

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>
@golang golang locked and limited conversation to collaborators Jun 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants