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: translator deletes generic objects without type parameters #40015

Closed
tdakkota opened this issue Jul 3, 2020 · 4 comments
Closed

cmd/go2go: translator deletes generic objects without type parameters #40015

tdakkota opened this issue Jul 3, 2020 · 4 comments
Assignees
Milestone

Comments

@tdakkota
Copy link

@tdakkota tdakkota commented Jul 3, 2020

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

$ go version
go version devel +85ed317eb2 Thu Jul 2 00:33:43 2020 +0000 windows/amd64

Does this issue reproduce with the latest release?

n/a

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

  • windows/amd64
  • Go2go playground

What did you do?

https://go2goplay.golang.org/p/ABjdAJsVfgj

What did you expect to see?

Successful compilation or error like generic function should have at least one type parameter

What did you see instead?

./prog.go2:16: undefined: Print

It's go compiler's output, not go2go.

@tdakkota tdakkota changed the title cmd/go2go: translator deletes function from original code cmd/go2go: translator deletes generic objects without type parameters Jul 3, 2020
@tdakkota
Copy link
Author

@tdakkota tdakkota commented Jul 3, 2020

For other objects does not work too.

package main

type S(type) struct{}

func main() {
	var _ S // compiler error: ./prog.go2:6: undefined: S
	var _ S() // go2go error: S is not a generic type
	var _ S(int) // go2go error: S is not a generic type
}

https://go2goplay.golang.org/p/_ebbO1tDKjW

@cagedmantis cagedmantis added this to the Unreleased milestone Jul 6, 2020
@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Jul 6, 2020

@ianlancetaylor ianlancetaylor self-assigned this Jul 6, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 6, 2020

Change https://golang.org/cl/241124 mentions this issue: [dev.go2go] go/go2go: F(type)() is not a parameterized function

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 6, 2020

The initial test case is fixed on the dev.go2go branch.

I think the test case in #40015 (comment) is acting correctly in reporting S is not a generic type. If there are no type parameters, there should be no type arguments. We could also change that around. It doesn't seem very important at present.

gopherbot pushed a commit that referenced this issue Jul 6, 2020
Fixes #40015

Change-Id: I4e70398e693a53268d3400e829a179c76ff70e75
Reviewed-on: https://go-review.googlesource.com/c/go/+/241124
Reviewed-by: Ian Lance Taylor <iant@golang.org>
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
4 participants
You can’t perform that action at this time.