Skip to content

Warn on unused given in class that only used for contructing the same class #24698

@eejbyfeldt

Description

@eejbyfeldt

Compiler version

3.7.4

Minimized example

object test {
  trait TC[X] {
    def notTrivial: Int
  }

  class C[T: TC]() {
    def mod: C[T] = new C()
  }
}

Output

No warning.

Expectation

If one removes the mod method one gets a warning. It would be nice if it would still warn even when mod is defined. Since the TC[T] instances only get used for calling Cs constructor it is effectively unused.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions