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

Comments

@bjg2
Copy link

@bjg2 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

@andybons andybons commented Jun 30, 2020

@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 this to the Unplanned milestone Jun 30, 2020
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 30, 2020

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

@andybons andybons commented Jun 30, 2020

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

@bjg2
Copy link
Author

@bjg2 bjg2 commented Jun 30, 2020

Yes it does now, thanks!

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 30, 2020

Thanks @andybons!

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
3 participants
You can’t perform that action at this time.