Skip to content

Commit f089c91

Browse files
committed
Filter member of refinement, handle Annotated
1 parent 3a07f34 commit f089c91

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

compiler/src/dotty/tools/dotc/transform/CheckUnused.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ class CheckUnused private (phaseMode: CheckUnused.PhaseMode, suffix: String, _ke
222222
transformAllDeep(hi)
223223
transformAllDeep(alias)
224224
case tree: NamedArg => transformAllDeep(tree.arg)
225+
case Annotated(arg, annot) =>
226+
transformAllDeep(arg)
227+
transformAllDeep(annot)
225228
case _: InferredTypeTree =>
226229
case _ if tree.isType =>
227230
//println(s"OTHER TYPE ${tree.getClass} ${tree.show}")
@@ -684,6 +687,7 @@ object CheckUnused:
684687
&& !memDef.symbol.isAllOf(Flags.AccessorCreationFlags)
685688
&& !memDef.name.isWildcard
686689
&& !memDef.symbol.owner.is(ExtensionMethod)
690+
&& !memDef.symbol.owner.isRefinementClass
687691

688692
private def isValidParam(using Context): Boolean =
689693
val sym = memDef.symbol

tests/pos/i17631.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -Xfatal-warnings -Wunused:all -deprecation -feature
1+
//> using options -Werror -Wunused:all -deprecation -feature
22

33
object foo {
44
type Bar

tests/warn/i19657.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ class `scope of super`:
8383
class E(e: Int) extends C(i + k):
8484
def g = e + y + k + 1
8585
E(0).g
86+
87+
import scala.annotation.meta.*
88+
object Alias {
89+
type A = Deprecated @param
90+
}

0 commit comments

Comments
 (0)