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
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@tdakkota
Copy link

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 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 cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 6, 2020
@cagedmantis
Copy link
Contributor

/cc @ianlancetaylor @griesemer

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

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

@ianlancetaylor
Copy link
Contributor

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