golang/mock

Parser fails to parse parametrized generic return types

jammer312 opened this issue · 1 comments

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

  • gomock mode (reflect or source): source (might be both, but I couldn't figure out an easy way to check it for reflect mode)
  • gomock version or git ref: v1.6.0
  • golang version: go1.18.2

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