Skip to content

-Wunused:all reports setter instead of unset variable in anon class #23200

@mberndt123

Description

@mberndt123

Compiler version

3.7.0

Minimized code

trait Foo
trait Bar

new Foo {
  var x: Int = 42
  val _ = new Bar:
    println(x)
}

The compiler issues an "unused private member" warning for var x in line 5, even though it is used in line 7.
Scastie

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