@@ -600,7 +600,6 @@ object CheckUnused:
600600 || m.is(Synthetic )
601601 || m.hasAnnotation(dd.UnusedAnnot ) // param of unused method
602602 || sym.name.is(ContextFunctionParamName ) // a ubiquitous parameter
603- || sym.isCanEqual
604603 || sym.info.dealias.typeSymbol.match // more ubiquity
605604 case dd.DummyImplicitClass | dd.SubTypeClass | dd.SameTypeClass => true
606605 case tps =>
@@ -632,7 +631,6 @@ object CheckUnused:
632631 def checkLocal (sym : Symbol , pos : SrcPos ) =
633632 if ctx.settings.WunusedHas .locals
634633 && ! sym.is(InlineProxy )
635- && ! sym.isCanEqual
636634 then
637635 if sym.is(Mutable ) && infos.asss(sym) then
638636 warnAt(pos)(UnusedSymbol .localVars)
@@ -664,8 +662,9 @@ object CheckUnused:
664662 import scala .jdk .CollectionConverters .given
665663 import Rewrites .ActionPatch
666664 type ImpSel = (Import , ImportSelector )
665+ // true if used or might be used, to imply don't warn about it
667666 def isUsable (imp : Import , sel : ImportSelector ): Boolean =
668- sel.isImportExclusion || infos.sels.containsKey(sel) || imp.isLoose(sel)
667+ sel.isImportExclusion || infos.sels.containsKey(sel)
669668 def warnImport (warnable : ImpSel , actions : List [CodeAction ] = Nil ): Unit =
670669 val (imp, sel) = warnable
671670 val msg = UnusedSymbol .imports(actions)
@@ -940,8 +939,6 @@ object CheckUnused:
940939 def isSerializationSupport : Boolean =
941940 sym.is(Method ) && serializationNames(sym.name.toTermName) && sym.owner.isClass
942941 && sym.owner.derivesFrom(defn.JavaSerializableClass )
943- def isCanEqual : Boolean =
944- sym.isOneOf(GivenOrImplicit ) && sym.info.finalResultType.baseClasses.exists(_.derivesFrom(defn.CanEqualClass ))
945942 def isMarkerTrait : Boolean =
946943 sym.info.hiBound.resultType.allMembers.forall: d =>
947944 val m = d.symbol
@@ -981,21 +978,6 @@ object CheckUnused:
981978 def isGeneratedByEnum : Boolean =
982979 imp.symbol.exists && imp.symbol.owner.is(Enum , butNot = Case )
983980
984- /** Under -Wunused:strict-no-implicit-warn, avoid false positives
985- * if this selector is a wildcard that might import implicits or
986- * specifically does import an implicit.
987- * Similarly, import of CanEqual must not warn, as it is always witness.
988- */
989- def isLoose (sel : ImportSelector ): Boolean =
990- if ctx.settings.WunusedHas .strictNoImplicitWarn then
991- if sel.isWildcard
992- || imp.expr.tpe.member(sel.name.toTermName).hasAltWith(_.symbol.isOneOf(GivenOrImplicit ))
993- || imp.expr.tpe.member(sel.name.toTypeName).hasAltWith(_.symbol.isOneOf(GivenOrImplicit ))
994- then return true
995- if sel.isWildcard && sel.isGiven
996- then imp.expr.tpe.allMembers.exists(_.symbol.isCanEqual)
997- else imp.expr.tpe.member(sel.name.toTermName).hasAltWith(_.symbol.isCanEqual)
998-
999981 extension (pos : SrcPos )
1000982 def isZeroExtentSynthetic : Boolean = pos.span.isSynthetic && pos.span.isZeroExtent
1001983 def isSynthetic : Boolean = pos.span.isSynthetic && pos.span.exists
0 commit comments