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

Commit d476d65

Browse files
authored
Parse parenthesized parameter-type. (#421)
Add test.
1 parent ccaa079 commit d476d65

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Parenthesized Parameter Type
2+
3+
Test for [Issue#416](https://github.com/golang/mock/issues/416).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package parenthesized_parameter_type
2+
3+
type Example interface {
4+
ParenthesizedParameterType(param *(int))
5+
}

mockgen/internal/tests/parenthesized_parameter_type/mock.go

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mockgen/parse.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ func (p *fileParser) parseType(pkg string, typ ast.Expr) (model.Type, error) {
424424
return nil, p.errorf(v.Pos(), "can't handle non-empty unnamed struct types")
425425
}
426426
return model.PredeclaredType("struct{}"), nil
427+
case *ast.ParenExpr:
428+
return p.parseType(pkg, v.X)
427429
}
428430

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

0 commit comments

Comments
 (0)