-
Notifications
You must be signed in to change notification settings - Fork 1.2k
False positive unused import on 3.8 for discarded import #24633
Copy link
Copy link
Closed
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintitype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore
Description
Compiler version
3.8.0-RC1, 3.8.0-RC1, and latest nightly 3.8.1-RC1-bin-20251202-9eb843d-NIGHTLY
Minimized code
//> using scala 3.8.1-RC1-bin-20251202-9eb843d-NIGHTLY
//> using options -Wunused:imports
object foo {
val min = 0
val max = 1
}
def test(max: Int) = {
import foo.{max as _, *}
s"$min - $max"
}Output
-- [E198] Unused Symbol Warning: -----------------------------------------------
7 | import foo.{max as _, *}
| ^^^^^^^^
| unused importExpectation
The import should not be reported as unused. If I change it to import foo.*, then I get this error:
-- [E049] Reference Error: -----------------------------------------------------
8 | s"$min - $max"
| ^^^
| Reference to max is ambiguous.
| It is both defined in method test
| and imported subsequently by import foo._Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintitype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore