@@ -118,6 +118,10 @@ class CheckUnused private (phaseMode: CheckUnused.PhaseMode, suffix: String, _ke
118
118
119
119
override def prepareForDefDef (tree : tpd.DefDef )(using Context ): Context =
120
120
unusedDataApply{ ud =>
121
+ if ! tree.rawMods.is(Private ) then
122
+ tree.termParamss.flatten.foreach { p =>
123
+ ud.addIgnoredParam(p.symbol)
124
+ }
121
125
import ud .registerTrivial
122
126
tree.registerTrivial
123
127
traverseAnnotations(tree.symbol)
@@ -350,6 +354,8 @@ object CheckUnused:
350
354
/** Trivial definitions, avoid registering params */
351
355
private val trivialDefs = MutSet [Symbol ]()
352
356
357
+ private val paramsToSkip = MutSet [Symbol ]()
358
+
353
359
/**
354
360
* Push a new Scope of the given type, executes the given Unit and
355
361
* pop it back to the original type.
@@ -396,6 +402,10 @@ object CheckUnused:
396
402
def removeIgnoredUsage (sym : Symbol )(using Context ): Unit =
397
403
doNotRegister --= sym.everySymbol
398
404
405
+ def addIgnoredParam (sym : Symbol )(using Context ): Unit =
406
+ paramsToSkip += sym
407
+
408
+
399
409
400
410
/** Register an import */
401
411
def registerImport (imp : tpd.Import )(using Context ): Unit =
@@ -411,7 +421,7 @@ object CheckUnused:
411
421
if memDef.isValidParam then
412
422
if memDef.symbol.isOneOf(GivenOrImplicit ) then
413
423
implicitParamInScope += memDef
414
- else
424
+ else if ! paramsToSkip.contains(memDef.symbol) then
415
425
explicitParamInScope += memDef
416
426
else if currScopeType.top == ScopeType .Local then
417
427
localDefInScope += memDef
0 commit comments