Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top-level private definitions are not reported as unused #20520

Open
rochala opened this issue Jun 4, 2024 · 0 comments · May be fixed by #20894
Open

Top-level private definitions are not reported as unused #20520

rochala opened this issue Jun 4, 2024 · 0 comments · May be fixed by #20894
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug

Comments

@rochala
Copy link
Contributor

rochala commented Jun 4, 2024

Compiler version

3.5.1-RC1-bin-20240602-c6fbe6f-NIGHTLY

Minimized code

Top level private definitions are not reported as unused.

//> using scala 3.nightly
//> using option -Wunused:all

@main def run =
  val veryUnusedVariable: Int = ???

private def veryUnusedMethod(x: Int): Unit = ???
private val veryUnusedVariableToplevel: Unit = ???


Output

//> using scala 3.nightly
//> using option -Wunused:all

@main def run =
  val veryUnusedVariable: Int = ??? // unused local definition

private def veryUnusedMethod(x: Int): Unit = ??? // no unused definition reported
private val veryUnusedVariableToplevel: Unit = ??? // no unused definition reported

Expectation

//> using scala 3.nightly
//> using option -Wunused:all

@main def run =
  val veryUnusedVariable: Int = ??? // unused local definition

private def veryUnusedMethod(x: Int): Unit = ??? // unused local definition
private val veryUnusedVariableToplevel: Unit = ??? // unused local definition
@rochala rochala added itype:bug area:linting Linting warnings enabled with -W or -Xlint labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant