Skip to content

False positive warning: Unused import of a package #23047

Closed
@OndrejSpanel

Description

@OndrejSpanel

Compiler version

3.7.0-RC1, 3.7.0-RC4

Minimized code

Main.scala:

package some.example
package demo

import some.example

object Main {

  def generic[T](x: Any): T = null.asInstanceOf[T]

  def main(args: Array[String]): Unit = {
    generic[example.Util](0)
  }
}

Util.scala:

package some.example

class Util

Output

unused import
import some.example

Expectation

The code does not compile without the import.

Note

The code does not make much sense, it can be fixed by using generic[Util](0) instead of generic[example.Util](0), but still, it probably should not create a false warning.

Metadata

Metadata

Assignees

Labels

area:lintingLinting warnings enabled with -W or -Xlintitype:bugregressionThis worked in a previous version but doesn't anymore

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions