Skip to content

Spurious unused private member warning on type with parameters used in abstract refined type #19998

Closed
@mrdziuban

Description

@mrdziuban

Compiler version

3.3.3, 3.4.0, and the latest nightly 3.4.2-RC1-bin-20240320-0ea0eba-NIGHTLY

Minimized code

//> using scala 3.4.1
//> using options -Wunused:privates

trait Foo {
  type X[a]
}

trait Bar[X[_]] {
  private final type SelfX[a] = X[a]
  val foo: Foo { type X[a] = SelfX[a] }
}

Output

-- Error: /Users/matt/scala-unused-private-type/src/main/scala/example/Test.scala:6:21
6 |  private final type SelfX[a] = X[a]
  |                     ^^^^^
  |                     unused private member

Expectation

SelfX should not be reported as unused. Interestingly, the warning goes away if X does not have type parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lintingLinting warnings enabled with -W or -Xlintarea:reportingError reporting including formatting, implicit suggestions, etcitype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions