What's changed
New Features
Expands the generics code generation #16
This library has already supported the generics syntax on only struct declaration.
This version expands the supported generics syntaxes/notations like the following:
- generic types on function invocation like
foo[int64](123)
- generic parameter names on function receiver like
func (s MyStruct[T])
- generic parameter names on function return values like
func foo[T struct]() MyStruct[T]
- generic type parameters on interface declaration like
type MyInterface[T any] interface {}
This patch also introduces TypeParameterNames
which is an alias of []string
to represent the generic parameter names, e.g. T
.
And this patch makes it supports the generics union types.