From 2a02996441bd54f9194f9af23393a34adf6a3cae Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Wed, 29 Mar 2023 19:19:13 +0200 Subject: [PATCH] Skip extension method params in WUnused --- community-build/community-projects/requests-scala | 2 +- .../src/dotty/tools/dotc/transform/CheckUnused.scala | 2 +- tests/neg-custom-args/fatal-warnings/i15503g.scala | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/community-build/community-projects/requests-scala b/community-build/community-projects/requests-scala index 2d7316a8f444..6d4a223bc33d 160000 --- a/community-build/community-projects/requests-scala +++ b/community-build/community-projects/requests-scala @@ -1 +1 @@ -Subproject commit 2d7316a8f444c2f38795e5905f90837e651c79c3 +Subproject commit 6d4a223bc33def14ae9a4def24a3f5c258451e8e diff --git a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala index 5e4ed6f6e0df..b9a726455bb7 100644 --- a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala +++ b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala @@ -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 diff --git a/tests/neg-custom-args/fatal-warnings/i15503g.scala b/tests/neg-custom-args/fatal-warnings/i15503g.scala index d4daea944184..ee8f6075d4f6 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503g.scala +++ b/tests/neg-custom-args/fatal-warnings/i15503g.scala @@ -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 \ No newline at end of file +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") + }