Skip to content

False positive unused parameter warning in 3.7 nightly on method with default parameters #22748

Closed
@mrdziuban

Description

@mrdziuban

Compiler version

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

Minimized code

def test[I, A](in: I)(
  run: I => Either[Throwable, A],
  onErr: Throwable => Throwable = identity[Throwable]
): Either[Throwable, A] =
  run(in) match {
    case Left(t) => Left(onErr(t))
    case r @ Right(_) => r
  }

Output

-- [E198] Unused Symbol Warning: /Users/matt/scala3.7-nightly-unused/src/main/scala/example/Test.scala:1:15 ------------
1 |def test[I, A](in: I)(
  |               ^^
  |               unused explicit parameter

Expectation

in should not be reported unused since it's passed to run. If I remove the default param for onErr then it compiles without warning

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions