Skip to content

Wunused position less useful in anonfun #11947

Open
@som-snytt

Description

@som-snytt

reproduction steps

scala> :pa -raw
// Entering paste mode (ctrl-D to finish)

class C {
  def testRangeConsistency: Unit = for(size <- Seq(0, 1, 2, 3, 4, 10, 100)) {
    val range = (1 to size)
  }
}

// Exiting paste mode, now interpreting.


    val range = (1 to size)
                   ^
<pastie>:3: warning: local val range in value $anonfun is never used

problem

    val range = (1 to size)
                   ^
<pastie>:3: warning: local val range in value $anonfun is never used

expectation

Warning names the correct enclosing definition, and caret is at the unused definition.

Not a repl artifact, same result in regular project.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions