Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Parse parenthesized parameter-type. #421

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mockgen/internal/tests/parenthesized_parameter_type/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Parenthesized Parameter Type

Test for [Issue#416](https://github.com/golang/mock/issues/416).
5 changes: 5 additions & 0 deletions mockgen/internal/tests/parenthesized_parameter_type/input.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package parenthesized_parameter_type

type Example interface {
ParenthesizedParameterType(param *(int))
}
45 changes: 45 additions & 0 deletions mockgen/internal/tests/parenthesized_parameter_type/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions mockgen/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ func (p *fileParser) parseType(pkg string, typ ast.Expr) (model.Type, error) {
return nil, p.errorf(v.Pos(), "can't handle non-empty unnamed struct types")
}
return model.PredeclaredType("struct{}"), nil
case *ast.ParenExpr:
return p.parseType(pkg, v.X)
}

return nil, fmt.Errorf("don't know how to parse type %T", typ)
Expand Down