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: compile error in some cases of method expressions on type parameters #39662

Carrotman42 opened this issue Jun 17, 2020 · 2 comments


Copy link

@Carrotman42 Carrotman42 commented Jun 17, 2020

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

The Go 2 dev playground at

What did you do?

Full example:


type I interface {

func takesI(type T I)(t T) {
	_ = T.F

func workaround(type T I)(t T) {
	_ = (T).F

As shown in the full example in the playground link above, calling takesI with T = *SomeType results in compilation failing. Calling workaround is fine, and since the only difference is the manual wrapping of parenthesis this indicates to me that the generated code is just missing grouping of its own which is causing the errors.

What did you see instead?

Error messages during compilation:

./prog.go2:4: invalid method expression P.F (needs pointer receiver: (*P).F)
./prog.go2:4: invalid indirect of V.F (type func(V))
Copy link

@gopherbot gopherbot commented Jun 17, 2020

Change mentions this issue: [dev.go2go] go/go2go: parenthesize type strings

gopherbot pushed a commit that referenced this issue Jun 17, 2020
Fixes #39662

Change-Id: Id176ec00474d66a24e95f2db092f3b4245a93cfb
Reviewed-by: Ian Lance Taylor <>
Copy link

@ianlancetaylor ianlancetaylor commented Jun 17, 2020

Thanks. Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.