lazy val root = (project in file("."))
.settings(
name := "sandbox",
scalacOptions ++= Seq("-Ywarn-unused:implicits")
)
trait Trait {
def func()(implicit i: Long): Unit
}
class Impl extends Trait {
override def func()(implicit i: Long): Unit = println("Impl")
}
Problem
On 2.13.12, the compiler unexpectedly warns:
[warn] /home/user/sandbox/src/main/scala/Trait.scala:8:32: parameter i in method func is never used
[warn] override def func()(implicit i: Long): Unit = println("Impl")
On 2.13.11, the compiler does not output a warning.
The above code is a minimalistic example but this pattern occurs quite often in code, e.g., then the implicit is an execution context.
Other remarks:
Adding a parameter to the method (e.g., func(j: Long)(implicit i: Long) make the warning disappear.
Removing the () (i.e., def func(implicit i: Long) make the warning disappear.
Note that I don't want to use solution 2. because I use () to indicate that my method has side effects.
Reproduction steps
Scala version: 2.13.12
Compiler flags:
Problem
On 2.13.12, the compiler unexpectedly warns:
On 2.13.11, the compiler does not output a warning.
The above code is a minimalistic example but this pattern occurs quite often in code, e.g., then the implicit is an execution context.
Other remarks:
func(j: Long)(implicit i: Long)
make the warning disappear.def func(implicit i: Long)
make the warning disappear.Note that I don't want to use solution 2. because I use
()
to indicate that my method has side effects.