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 @@ -471,7 +471,7 @@ object CheckUnused:
471
471
if ctx.settings.WunusedHas .implicits then
472
472
implicitParamInScope
473
473
.filterNot(d => d.symbol.usedDefContains)
474
- .filterNot(d => containsSyntheticSuffix(d.symbol) && ! d.rawMods.is(Given ))
474
+ .filterNot(d => containsSyntheticSuffix(d.symbol) && ( ! d.rawMods.is(Given ) || hasZeroLengthSpan(d.symbol) ))
475
475
.map(d => d.namePos -> WarnTypes .ImplicitParams ).toList
476
476
else
477
477
Nil
@@ -512,11 +512,18 @@ object CheckUnused:
512
512
val importedMembers = qual.tpe.member(sel.name).alternatives.map(_.symbol)
513
513
importedMembers.exists(s => s.is(Transparent ) && s.is(Inline ))
514
514
}).exists(identity)
515
+
515
516
/**
516
517
* Heuristic to detect synthetic suffixes in names of symbols
517
518
*/
518
519
private def containsSyntheticSuffix (symbol : Symbol )(using Context ): Boolean =
519
520
symbol.name.mangledString.contains(" $" )
521
+
522
+ /**
523
+ * Heuristic to detect generated symbols by checking if symbol has zero length span in source
524
+ */
525
+ private def hasZeroLengthSpan (symbol : Symbol )(using Context ): Boolean =
526
+ symbol.span.end - symbol.span.start == 0
520
527
/**
521
528
* Is the the constructor of synthetic package object
522
529
* Should be ignored as it is always imported/used in package
You can’t perform that action at this time.
0 commit comments