scala/scala3

-Wunused gives false positives on unused explicit parameters of (non-explicitly declared) overridden methods

Closed this issue · 2 comments

Compiler version

3.3.0-RC2

Minimized code

trait Base:
  def fn(a: Int, b: Int): Int 

object Ex extends Base:
  //false positive unused parameter
  def fn(a: Int, b: Int): Int = b + 3

object Ex2 extends Base:
  override def fn(a: Int, b: Int): Int = b + 3

Output

The compiler reports that fn in Ex has an unused explicit parameter a. This is the truth, but fn is an undeclared override of fn from Base.

Expectation

Either that the compiler doesn't warn, or complains that the user hasn't declared the override explicitly.

@jchyb Maybe create a separate label for warn unused? There seem to be quite a lot of bug reports about that one specifically. That would make it easier to direct someone who can fix it to the issues.

jchyb commented

Done, I went ahead and swapped area:reporting to area:warn-unused where applicable