Skip to content

Wunused: False positive for compiletime.testing.typeCheckErrors #23967

@jchyb

Description

@jchyb

Compiler version

3.7.0 and up

Minimized code

//> using options --rewrite -Wunused:imports

def test: Unit = {
  import scala.compiletime.testing.typeCheckErrors
  typeCheckErrors("2 + 2")
}

Output

[warn] ./a.scala:4:36
[warn] unused import
[warn]   import scala.compiletime.testing.typeCheckErrors
[warn]                                    ^^^^^^^^^^^^^^^

Recompiling with the import incorrectly removed:

  • scala 3.7.0, 3.7.3 (compilation successful ???):
[warn] ./a.scala:4:36
[warn] unused import
[warn]   typeCheckErrors("2 + 2")
[warn]                                    ^^^^^^^^^^^^^^^
  • 3.7.1, 3.7.2, 3.8.0-RC1-bin-20250912-c4c48e3-NIGHTLY:
[error] ./a.scala:4:3
[error] Not found: typeCheckErrors
[error]   typeCheckErrors("2 + 2")
[error]   ^^^^^^^^^^^^^^^

Expectation

No warning

Metadata

Metadata

Assignees

No one assigned

    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