compiler: allow unnamed params for exported methods

Adjust the result of #2601.
This commit is contained in:
Anna Shaleva 2022-08-17 12:23:31 +03:00
parent 5d5455312a
commit 171364f07f
2 changed files with 12 additions and 2 deletions

View file

@ -285,11 +285,12 @@ func (c *codegen) analyzeFuncUsage() funcUsage {
case *ast.FuncDecl:
name := c.getFuncNameFromDecl(pkgPath, n)
// exported functions are always assumed to be used
// exported functions and methods are always assumed to be used
if isMain && n.Name.IsExported() || isInitFunc(n) || isDeployFunc(n) {
diff[name] = true
}
if isMain && n.Name.IsExported() {
// exported functions are not allowed to have unnamed parameters
if isMain && n.Name.IsExported() && n.Recv == nil {
if n.Type.Params.List != nil {
for i, param := range n.Type.Params.List {
if param.Names == nil {