Skip to content

Commit 9d1e58b

Browse files
committed
fix: parenthesized expression as receiver
1 parent c549a34 commit 9d1e58b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

check/check.go

+2
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,8 @@ func recvPrefix(recv *ast.FieldList) string {
913913
return expr.Name + "."
914914
case *ast.IndexExpr:
915915
return expr.X.(*ast.Ident).Name + "."
916+
case *ast.ParenExpr:
917+
return expr.X.(*ast.Ident).Name + "."
916918
case *ast.IndexListExpr:
917919
return expr.X.(*ast.Ident).Name + "."
918920
default:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
! exec unparam .
2+
cmp stdout stdout.golden
3+
4+
-- go.mod --
5+
module testdata.tld/foo
6+
7+
go 1.18
8+
-- stdout.golden --
9+
foo_main.go:5:37: (*FooType).multImplsMethod - a is unused
10+
-- foo.go --
11+
package foo
12+
13+
var DoWork func()
14+
15+
type FooType int
16+
17+
-- foo_main.go --
18+
//+build !other
19+
20+
package foo
21+
22+
func (f *(FooType)) multImplsMethod(a int) int64 {
23+
DoWork()
24+
return 3
25+
}

0 commit comments

Comments
 (0)