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: generics embedding not working as proposed #39944

Closed
bjg2 opened this issue Jun 30, 2020 · 5 comments
Closed

cmd/go2go: generics embedding not working as proposed #39944

bjg2 opened this issue Jun 30, 2020 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bjg2
Copy link

bjg2 commented Jun 30, 2020

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

go2go playground (https://go2goplay.golang.org/)

Does this issue reproduce with the latest release?

/

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

/

What did you do?

Embeded generic parameter:

package main

import (
	"fmt"
)

type A struct {
	Something int
}

type B(type T) struct {
	T
	Common int
}

func main() {
	test := &B(A){
		T: A{
			Something: 2,
		},
		Common: 12,
	}
	fmt.Println(test)
}

What did you expect to see?

That it is embeded, as described in the proposition:

image

What did you see instead?

# play
./prog.go2:12: undefined: T
@andybons
Copy link
Member

@griesemer @ianlancetaylor

@andybons andybons changed the title Generics embeding not working as proposed cmd/go2go: generics embedding not working as proposed Jun 30, 2020
@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 30, 2020
@andybons andybons added this to the Unplanned milestone Jun 30, 2020
@ianlancetaylor
Copy link
Contributor

Thanks for the bug report. This works on the current dev.go2go branch. The playground is not up to date with the branch yet.

@andybons
Copy link
Member

The playground has been updated and this example now works: https://go2goplay.golang.org/p/GX4u5kjnwtt

@bjg2
Copy link
Author

bjg2 commented Jun 30, 2020

Yes it does now, thanks!

@ianlancetaylor
Copy link
Contributor

Thanks @andybons!

@golang golang locked and limited conversation to collaborators Jun 30, 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