Skip to content

Commit

Permalink
Backport "Skip extension method params in WUnused" (#17275)
Browse files Browse the repository at this point in the history
Backports #17178
  • Loading branch information
Kordyjan authored Apr 17, 2023
2 parents 423bd1e + 7cbdadf commit ae37e68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 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 @@ -651,7 +651,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 ae37e68

Please sign in to comment.