Skip to content

False positive unused warnings in 3.7 nightly on implicits in method overrides #22895

Closed
@mrdziuban

Description

@mrdziuban

Compiler version

3.7.1-RC1-bin-20250328-d519790-NIGHTLY

Minimized code

trait Test[F[_], Ev] {
  def apply[A, B](fa: F[A])(f: A => B)(using ev: Ev): F[B]
}

given testId: Test[[a] =>> a, Unit] =
  new Test[[a] =>> a, Unit] {
    def apply[A, B](fa: A)(f: A => B)(using ev: Unit): B = f(fa)
  }

Output

[warn] -- [E198] Unused Symbol Warning: /Users/matt/scala3.7-nightly-unused/src/main/scala/example/Test.scala:7:44
[warn] 7 |    def apply[A, B](fa: A)(f: A => B)(using ev: Unit): B = f(fa)
[warn]   |                                            ^^
[warn]   |                                            unused implicit parameter

Expectation

The parameter should not be reported unused since it's required to satisfy the apply method override.

This is similar to #22742 which @som-snytt fixed in #22757 by suppressing unused warnings for explicit params in overrides -- could the same be done for implicits?

Metadata

Metadata

Assignees

Labels

area:implicitsrelated to implicitsarea:lintingLinting warnings enabled with -W or -Xlintitype:bugregressionThis worked in a previous version but doesn't anymore

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions