Skip to content

Commit

Permalink
fix: parenthesized expression as receiver (#78)
Browse files Browse the repository at this point in the history
Fixes #77.
  • Loading branch information
ldez authored Apr 27, 2024
1 parent c549a34 commit 063aff9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,8 @@ func recvPrefix(recv *ast.FieldList) string {
return expr.Name + "."
case *ast.IndexExpr:
return expr.X.(*ast.Ident).Name + "."
case *ast.ParenExpr:
return expr.X.(*ast.Ident).Name + "."
case *ast.IndexListExpr:
return expr.X.(*ast.Ident).Name + "."
default:
Expand Down
20 changes: 20 additions & 0 deletions testdata/script/parenthesized_expression.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
! exec unparam .
cmp stdout stdout.golden

-- go.mod --
module testdata.tld/foo

go 1.18
-- stdout.golden --
foo.go:7:37: (*FooType).multImplsMethod - a is unused
-- foo.go --
package foo

var DoWork func()

type FooType int

func (f *(FooType)) multImplsMethod(a int) int64 {
DoWork()
return 3
}

0 comments on commit 063aff9

Please sign in to comment.