golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.26k stars 608 forks source link

Parser fails to parse parametrized generic return types #654

Closed jammer312 closed 2 years ago

jammer312 commented 2 years ago

When trying to generate mocks for cases such like this one:

package interfaces

type A[T any] interface {
  A() T
}

type B[T any] interface {
  B() A[T]
}

in source mode it crashes with following message Loading input failed: interfaces.go:8:3: failed parsing returns: don't know how to parse type *ast.IndexExpr (it doesn't like A[T] as return type)

Additional Information

codyoss commented 2 years ago

This should work on HEAD if you install from source, a release has not been made yet.