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: Type aliases of generic types fail to compile #39768

Closed
firelizzard18 opened this issue Jun 23, 2020 · 3 comments
Closed

cmd/go2go: Type aliases of generic types fail to compile #39768

firelizzard18 opened this issue Jun 23, 2020 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@firelizzard18
Copy link
Contributor

The design draft (Appendix > Generic type aliases) indicates that the following would work:

package pkg

type Vector(type T) []T
type VectorAlias = Vector
var v Vector(int)

However, it doesn't: https://go2goplay.golang.org/p/Gnfiupx2_xT

type checking failed for main
prog.go2:4:20: cannot use generic type Vector(type T) without instantiation

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

go2goplay.golang.org and go version devel +da7932368b Mon Jun 22 19:06:44 2020 +0000 linux/amd64

@griesemer
Copy link
Contributor

At the moment only this works.

This is a current limitation of the prototype.

@griesemer griesemer self-assigned this Jun 23, 2020
@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 23, 2020
@griesemer griesemer added this to the Unreleased milestone Jun 23, 2020
@gopherbot
Copy link

Change https://golang.org/cl/239387 mentions this issue: [dev.go2go] go/types: permit alias to generic type

@griesemer
Copy link
Contributor

Turns out this was trivial to fix. Now implemented on dev.go2go. In the playground when it gets updated.

@firelizzard18 Thanks for bringing this to my attention.

gopherbot pushed a commit that referenced this issue Jun 23, 2020
Fixes #39768.

Change-Id: I68c8fbec5adc50e448dabe90b212ef147a384a06
Reviewed-on: https://go-review.googlesource.com/c/go/+/239387
Reviewed-by: Robert Griesemer <gri@golang.org>
@golang golang locked and limited conversation to collaborators Jun 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants