Skip to content

No warning on unused private case class inside object #24235

@eejbyfeldt

Description

@eejbyfeldt

Compiler version

3.7.3

Minimized example

object Test {
  private case class Unused()
}

Output Error/Warning message

$ scala-cli compile -S 3.3.7 -Wall unused_private_class.scala

Why this Error/Warning was not helpful

This is no warning about the class Unused being unused.

Suggested improvement

By dropping the case modified the compiler instead warns on it being unused

$ scala-cli compile -S 3.3.7 -Wall unused_private_class.scala 
Compiling project (Scala 3.3.7, JVM (21))
[warn] ./unused_private_class.scala:2:17
[warn] unused private member
[warn]   private class Unused()
[warn]                 ^^^^^^
Compiled project (Scala 3.3.7, JVM (21))

It could be made more helpful by also warn on case classes.

Metadata

Metadata

Assignees

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