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

Commit

Permalink
Parse parenthesized parameter-type. (#421)
Browse files Browse the repository at this point in the history
Add test.
  • Loading branch information
Krout0n authored Mar 30, 2020
1 parent ccaa079 commit d476d65
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
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

0 comments on commit d476d65

Please sign in to comment.