Skip to content

hope go generics in 1.18(or later) support return type inference #49520

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

Closed
LeGamerDc opened this issue Nov 11, 2021 · 1 comment
Closed

hope go generics in 1.18(or later) support return type inference #49520

LeGamerDc opened this issue Nov 11, 2021 · 1 comment

Comments

@LeGamerDc
Copy link

from generics proposal, if i did not misunderstand, go generics won't support return type inference like this

func empty[T any]() T {
     return T{}
}

i hope this feature could be added to go generics, and if not, i want to know why

@seankhliao
Copy link
Member

Duplicate of #35966

@seankhliao seankhliao marked this as a duplicate of #35966 Nov 11, 2021
@golang golang locked and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants