Skip to content

“error: repeated argument not allowed here” when varargs are present in the codebase #30

Description

@rajcspsg

I'm using varargs like below in my code base.

     def acceptVarargs[S](s: S*): Unit = {}
     def toVarArgs[T](s: Seq[T]) = acceptVarargs(s: _*)

I'm using autofix plugin in my sbt project.

I'm following the steps here to run the scalafix command.

When I run the command sbt> scalafixAll dependency:RenameDeprecatedPackage@org.scalatest:autofix:3.0.8-1 I get below Error.

[error] /Users/rajkumar.natarajan/Documents/Coding/misc/varargs-scalafix-error/src/main/scala/Utils.scala:3: error: repeated argument not allowed here
[error] def toVarArgs[T](s: Seq[T]) = acceptVarargs(s: _*)
[error] ^
[error] at scala.meta.internal.parsers.Reporter.syntaxError(Reporter.scala:16)
[error] at scala.meta.internal.parsers.Reporter.syntaxError$(Reporter.scala:16)
[error] at scala.meta.internal.parsers.Reporter$$anon$1.syntaxError(Reporter.scala:22)
[error] at scala.meta.internal.parsers.Reporter.syntaxError(Reporter.scala:17)
[error] at scala.meta.internal.parsers.Reporter.syntaxError$(Reporter.scala:17)

The complete error stack trace is here

The project in github here

Other details -

sbt version - 1.5.2
scala version - 2.12.10
java version - 11.0.10-zulu

What is wrong in my codebase with varargs? How can I fix this error?

Related SO question as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions