@@ -114,6 +114,10 @@ class CheckUnused extends MiniPhase:
114
114
115
115
override def prepareForDefDef (tree : tpd.DefDef )(using Context ): Context =
116
116
unusedDataApply{ ud =>
117
+ if ! tree.rawMods.is(Private ) then
118
+ tree.termParamss.flatten.foreach { p =>
119
+ ud.addIgnoredParam(p.symbol)
120
+ }
117
121
import ud .registerTrivial
118
122
tree.registerTrivial
119
123
traverseAnnotations(tree.symbol)
@@ -331,6 +335,8 @@ object CheckUnused:
331
335
/** Trivial definitions, avoid registering params */
332
336
private val trivialDefs = MutSet [Symbol ]()
333
337
338
+ private val paramsToSkip = MutSet [Symbol ]()
339
+
334
340
/**
335
341
* Push a new Scope of the given type, executes the given Unit and
336
342
* pop it back to the original type.
@@ -365,6 +371,10 @@ object CheckUnused:
365
371
def removeIgnoredUsage (sym : Symbol )(using Context ): Unit =
366
372
doNotRegister --= sym.everySymbol
367
373
374
+ def addIgnoredParam (sym : Symbol )(using Context ): Unit =
375
+ paramsToSkip += sym
376
+
377
+
368
378
369
379
/** Register an import */
370
380
def registerImport (imp : tpd.Import )(using Context ): Unit =
@@ -380,7 +390,7 @@ object CheckUnused:
380
390
if memDef.isValidParam then
381
391
if memDef.symbol.isOneOf(GivenOrImplicit ) then
382
392
implicitParamInScope += memDef
383
- else
393
+ else if ! paramsToSkip.contains(memDef.symbol) then
384
394
explicitParamInScope += memDef
385
395
else if currScopeType.top == ScopeType .Local then
386
396
localDefInScope += memDef
0 commit comments