Skip to content

Unused implicit conversion imports are not detected under certain circumstances #22976

Open
@jdrphillips

Description

@jdrphillips

Compiler version

3.6.4

Minimized code

package testing

object Syntax {
  implicit def conversion(a: DummyClass): DummyClass = new DummyClass
}

class DummyClass

import Syntax.*

case class CaseClass(field: Boolean)

Note: I could not reproduce this in the REPL

Output

Expectation

The above code should return the following warning:

[warn] -- [E198] Test2.scala:9:14 
[warn] 9 |import Syntax.*
[warn]   |              ^
[warn]   |              unused import
[warn] one warning found

As far as I can tell, this warning behaves correctly for:

  • trait
  • class
  • abstract class
  • object
  • def

The warning behaves incorrectly for:

  • case class
  • case object (even trivial ones)

Note also this occurs even if the implicit conversion is completely irrelevant to any types involved, as in the above example

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:implicitsrelated to implicitsarea:lintingLinting warnings enabled with -W or -Xlintitype:bugstat:fixed in nextThe issue was fixed in Next and only still applies to LTS.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions