-
Notifications
You must be signed in to change notification settings - Fork 18k
type alias with type that have type parameters doesn't work in go1.18rc #51516
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
Comments
I fully trust your judgment @mengzhuo that those are related to this and not a type parameters related issue. |
@mengzhuo are you certain this is a dup? This is not an issue of parameterized aliases, nor or type alias cycles. A trivial type alias to any parameterized type is rejected, contrary to the example in the generics proposal itself: https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#generic-type-aliases Asking mostly because that "umbrella" issue sounds larger in scope and because a similar issue appears to have cropped up in the generics prototype, which @griesemer fixed easily there: #39768 https://go.dev/play/p/yC68DoFSKrl package main
type Vector[T any] []T
type VectorAlias = Vector
var v VectorAlias[int]
Otherwise please ignore me and I will follow #25838. |
Unless of course permitting an alias to a parameterized type implies a parameterized alias which could be subject to cycle issues? I'm new to go1.18 generics and am learning, thanks! |
Per the spec:
This is working as intended. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
go1.18rc1 seems to be the latest at the moment. (
Mon Mar 7 09:50:11 AM CET 2022
)What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Based on the following document guidance: go.googlesource.com/proposal#generic-type-aliases
I hoped that I can make a type alias for a type that has type parameters with refactoring purposes.
What did you see instead?
Let me know if I can help with the issue,
and thank you very much for your support!
The text was updated successfully, but these errors were encountered: