Skip to content

False positive unused warnings in 3.7 nightly on method overrides #22742

Closed
@mrdziuban

Description

@mrdziuban

Compiler version

3.7.0-RC1-bin-20250306-73ba485-NIGHTLY

Minimized code

With -Wunused:explicits enabled:

trait Foldable[F[_]] {
  def foldLeft[A, B](fa: F[A], b: B)(f: (B, A) => B): B
}

type Id[A] = A

given foldableId: Foldable[Id] =
  new Foldable[Id] {
    def foldLeft[A, B](fa: Id[A], b: B)(f: (B, A) => B): B = b
  }

Output

-- [E198] Unused Symbol Warning: /Users/matt/scala3.7-nightly-unused/src/main/scala/example/Test.scala:9:23
9 |    def foldLeft[A, B](fa: Id[A], b: B)(f: (B, A) => B): B = b
  |                       ^^
  |                       unused explicit parameter
-- [E198] Unused Symbol Warning: /Users/matt/scala3.7-nightly-unused/src/main/scala/example/Test.scala:9:40
9 |    def foldLeft[A, B](fa: Id[A], b: B)(f: (B, A) => B): B = b
  |                                        ^
  |                                        unused explicit parameter

Expectation

The parameters should not be reported unused since they're necessary to satisfy the method override

Metadata

Metadata

Assignees

Labels

area:lintingLinting warnings enabled with -W or -Xlintitype:bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions