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: embedded types ignored in interface implementation #40199

Closed
JavierZunzunegui opened this issue Jul 14, 2020 · 8 comments
Closed

cmd/go2go: embedded types ignored in interface implementation #40199

JavierZunzunegui opened this issue Jul 14, 2020 · 8 comments
Labels
FrozenDueToAge generics Issue is related to generics NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@JavierZunzunegui
Copy link

This is not a generics proposal, but reporting a bug in the generics branch. First presented in golang-nuts.

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

generics branch (from https://go2goplay.golang.org/)

Does this issue reproduce with the latest release?

No, just generics branch

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

N/A (in https://go2goplay.golang.org/)

What did you do?

Assigned a generic type to an interface satisfied by a struct embedded in it.
https://go2goplay.golang.org/p/fOJIhgnbOxC

What did you expect to see?

It would implement the interface, and compile.

What did you see instead?

It doesn't implement the interface, and therefore doesn't compile.

@andybons
Copy link
Member

@ianlancetaylor @griesemer

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 14, 2020
@andybons andybons added this to the Unplanned milestone Jul 14, 2020
@mmaedel
Copy link

mmaedel commented Jul 14, 2020

Hi can you please change title?

cmd/go2go...

@griesemer griesemer changed the title generics: embedded types ignored in interface implementation cmd/go2go: embedded types ignored in interface implementation Jul 14, 2020
@griesemer
Copy link
Contributor

@mmaedel Done.

@griesemer
Copy link
Contributor

This code passes the type-checker. Likely an issue with the translator phase.

@griesemer
Copy link
Contributor

Test case updated to new syntax: https://go2goplay.golang.org/p/Ssd4Ws7F91G

@JavierZunzunegui
Copy link
Author

Just checking in - is this bug being looked into?
And particularly, has there been any discussion within the go team about Type embedding in generic types?

@griesemer
Copy link
Contributor

See https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#embedded-type-parameter-methods.

We know about this bug, but it's not urgent. Note that dev.go2go is a prototype. Not everything will be supported.

@ianlancetaylor
Copy link
Contributor

The decision here is that we don't permit embedded fields to be type parameters. The current compiler gives an error.

@ianlancetaylor ianlancetaylor added the generics Issue is related to generics label Jan 27, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge generics Issue is related to generics 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

6 participants