Skip to content

Commit

Permalink
Skip extension method params in WUnused
Browse files Browse the repository at this point in the history
  • Loading branch information
szymon-rd committed Mar 29, 2023
1 parent d640193 commit 2a02996
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/CheckUnused.scala
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ object CheckUnused:

extension (memDef: tpd.MemberDef)
private def isValidMemberDef(using Context): Boolean =
!memDef.symbol.isUnusedAnnot && !memDef.symbol.isAllOf(Flags.AccessorCreationFlags) && !memDef.name.isWildcard
!memDef.symbol.isUnusedAnnot && !memDef.symbol.isAllOf(Flags.AccessorCreationFlags) && !memDef.name.isWildcard && !memDef.symbol.owner.is(Extension)

private def isValidParam(using Context): Boolean =
val sym = memDef.symbol
Expand Down
9 changes: 8 additions & 1 deletion tests/neg-custom-args/fatal-warnings/i15503g.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,11 @@ def f7(a: Int)(using Int) = summon[Int] + a // OK

/* --- Trivial method check --- */
def g1(x: Int) = 1 // OK
def g2(x: Int) = ??? // OK
def g2(x: Int) = ??? // OK

package foo.test.i17101:
type Test[A] = A
extension[A] (x: Test[A]) { // OK
def value: A = x
def causesIssue: Unit = println("oh no")
}

0 comments on commit 2a02996

Please sign in to comment.