File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -478,7 +478,7 @@ object CheckUnused:
478478 if ctx.settings.WunusedHas .implicits then
479479 implicitParamInScope
480480 .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) ))
482482 .map(d => d.namePos -> WarnTypes .ImplicitParams ).toList
483483 else
484484 Nil
@@ -519,11 +519,18 @@ object CheckUnused:
519519 val importedMembers = qual.tpe.member(sel.name).alternatives.map(_.symbol)
520520 importedMembers.exists(s => s.is(Transparent ) && s.is(Inline ))
521521 }).exists(identity)
522+
522523 /**
523524 * Heuristic to detect synthetic suffixes in names of symbols
524525 */
525526 private def containsSyntheticSuffix (symbol : Symbol )(using Context ): Boolean =
526527 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
527534 /**
528535 * Is the the constructor of synthetic package object
529536 * Should be ignored as it is always imported/used in package
You can’t perform that action at this time.
0 commit comments