Skip to content

Missing unused warnings for lambdas parameters #20951

Closed
@mbovel

Description

@mbovel

In Scala 2.13:

object Foo {
  val dummy = 42
  def f(): Unit = Option(1).map((x: Int) => dummy)
  def main(args: Array[String]): Unit = {}
}
➜  ~/scala-snippets-6 scala-cli -Ywarn-unused -S 2.13 warning_lamdas.scala
[warn] ./warning_lamdas.scala:3:34
[warn] parameter x in anonymous function is never used
[warn]   def f(): Unit = Option(1).map((x: Int) => dummy)

In Scala 3, no warning.

Might be due to #17223.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions