Skip to content

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

Closed
@LeGamerDc

Description

@LeGamerDc

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions