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: failure to compile dot import #40379

Closed
mdempsky opened this issue Jul 24, 2020 · 4 comments
Closed

cmd/go2go: failure to compile dot import #40379

mdempsky opened this issue Jul 24, 2020 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mdempsky
Copy link
Member

I think this program should be okay: https://go2goplay.golang.org/p/WBPOXmHnT9S

But it currently fails to compile with output:

# play
./prog.go2:11: syntax error: unexpected ., expecting expression

Go build failed.

/cc @griesemer

@griesemer
Copy link
Contributor

This type-checks fine. Looks like an issue with the translator.

@griesemer griesemer added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 24, 2020
@griesemer griesemer added this to the Unreleased milestone Jul 24, 2020
@griesemer
Copy link
Contributor

This is unrelated to the name of the type parameter, or generic code for that matter. This code has the same problem.

@griesemer griesemer changed the title cmd/go2go: failure to compile type parameter names that shadow dot-imported identifiers cmd/go2go: failure to compile dot import Jul 24, 2020
@ianlancetaylor
Copy link
Contributor

This is a bug in the translation tool. It's hard to fix, because go/types doesn't keep track of the package alias, so it's hard for the translation tool to see that the package alias is ".". When rewriting generic the tool needs to qualify lots of identifiers with the package name, and all those qualifications fail with a package alias of ".".

The translation tool is just an experimental tool that isn't expected to handle all possible Go code. I don't think this is an important case, and I don't plan to work on it. If someone wants to send a fix, that would be fine.

Sorry.

@ianlancetaylor ianlancetaylor removed their assignment Jul 24, 2020
@seankhliao
Copy link
Member

No longer relevant

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jun 15, 2022
@golang golang locked and limited conversation to collaborators Jun 15, 2023
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

5 participants