File tree 1 file changed +8
-1
lines changed
compiler/src/dotty/tools/dotc/transform
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -478,7 +478,7 @@ object CheckUnused:
478
478
if ctx.settings.WunusedHas .implicits then
479
479
implicitParamInScope
480
480
.filterNot(d => d.symbol.usedDefContains)
481
- .filterNot(d => containsSyntheticSuffix(d.symbol) && ! d.rawMods.is(Given ))
481
+ .filterNot(d => containsSyntheticSuffix(d.symbol) && ( ! d.rawMods.is(Given ) || hasZeroLengthSpan(d.symbol) ))
482
482
.map(d => d.namePos -> WarnTypes .ImplicitParams ).toList
483
483
else
484
484
Nil
@@ -519,11 +519,18 @@ object CheckUnused:
519
519
val importedMembers = qual.tpe.member(sel.name).alternatives.map(_.symbol)
520
520
importedMembers.exists(s => s.is(Transparent ) && s.is(Inline ))
521
521
}).exists(identity)
522
+
522
523
/**
523
524
* Heuristic to detect synthetic suffixes in names of symbols
524
525
*/
525
526
private def containsSyntheticSuffix (symbol : Symbol )(using Context ): Boolean =
526
527
symbol.name.mangledString.contains(" $" )
528
+
529
+ /**
530
+ * Heuristic to detect generated symbols by checking if symbol has zero length span in source
531
+ */
532
+ private def hasZeroLengthSpan (symbol : Symbol )(using Context ): Boolean =
533
+ symbol.span.end - symbol.span.start == 0
527
534
/**
528
535
* Is the the constructor of synthetic package object
529
536
* Should be ignored as it is always imported/used in package
You can’t perform that action at this time.
0 commit comments