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: instantiating slice/map of generic data type does not type check #39815

Closed
chrstphlbr opened this issue Jun 24, 2020 · 1 comment
Closed

Comments

@chrstphlbr
Copy link

@chrstphlbr chrstphlbr commented Jun 24, 2020

Hi,

I glanced over the type parameters design draft but could not find whether the described behavior is intended or not.

Best
Christoph

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

go2go playground

Does this issue reproduce with the latest release?

Yes (if the playground runs the latest version)

What did you do?

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

What did you expect to see?

I expected _ = []Container(T){} to type check;
instead, _ = [](Container(T)){} does type check.

The same pattern neither works with make, map, nor pointer types.

What did you see instead?

type checking failed for main
prog.go2:11:8: cannot use generic type Container(type T) without instantiation
@chrstphlbr
Copy link
Author

@chrstphlbr chrstphlbr commented Jun 24, 2020

Sorry for the issue, I found it in the design draft.

@chrstphlbr chrstphlbr closed this Jun 24, 2020
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
1 participant
You can’t perform that action at this time.