Skip to content

False positive unused warning with -Wunused:params and extension #17101

Closed
@mrdziuban

Description

@mrdziuban

Compiler version

3.3.0-RC3

Minimized code

https://scastie.scala-lang.org/mrdziuban/nBgViUmQQkiecLQSHAe71w/12

type Test[A] = A

extension [A](x: Test[A]) {
  def value: A = x
  def causesIssue: Unit = println("oh no")
}

Output

extension [A](x: Test[A]) {
           // ^
           // unused explicit parameter

Expectation

Since x is used in def value the parameter should not be reported as unused. This only happens when def causesIssue is present, so I'm guessing that this is related to how extension methods are desugared and the unused warning is because that particular method doesn't use x.

Metadata

Metadata

Assignees

Labels

area:lintingLinting warnings enabled with -W or -Xlintitype:bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions