WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
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