Skip to content

-Wunused false positive on compiletime usage #21805

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

Open
som-snytt opened this issue Oct 18, 2024 · 1 comment
Open

-Wunused false positive on compiletime usage #21805

som-snytt opened this issue Oct 18, 2024 · 1 comment
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug

Comments

@som-snytt
Copy link
Contributor

Compiler version

3.5.1

Minimized code

package p:
  val code = "\"hello, world\""

package q:
  import p.*
  import scala.compiletime.testing.*
  def test() = typeCheckErrors("println(code)")

@main def test() = println:
  q.test()

Output

  snips scala run --server=false -Wunused:all testing.scala
-- [E198] Unused Symbol Warning: /home/amarki/snips/testing.scala:6:11 -------------------------------------------------
6 |  import p.*
  |           ^
  |           unused import
1 warning found
List()

Expectation

It would be nice if the lint were aware of compiletime ops.

@som-snytt
Copy link
Contributor Author

My first idea was to improve representation of these ops with Inlined nodes, which would preserve references for the lint.

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

No branches or pull requests

1 participant