@@ -883,20 +883,20 @@ object CheckUnused:
883
883
inline def exists (p : Name => Boolean ): Boolean = nm.ne(nme.NO_NAME ) && p(nm)
884
884
inline def isWildcard : Boolean = nm == nme.WILDCARD || nm.is(WildcardParamName )
885
885
886
- extension (tp : Type )
887
- def importPrefix ( using Context ) : Type = tp match
886
+ extension (tp : Type )( using Context )
887
+ def importPrefix : Type = tp match
888
888
case tp : NamedType => tp.prefix
889
889
case tp : ClassInfo => tp.prefix
890
890
case tp : TypeProxy => tp.superType.normalizedPrefix
891
891
case _ => NoType
892
- def underlyingPrefix ( using Context ) : Type = tp match
892
+ def underlyingPrefix : Type = tp match
893
893
case tp : NamedType => tp.prefix
894
894
case tp : ClassInfo => tp.prefix
895
895
case tp : TypeProxy => tp.underlying.underlyingPrefix
896
896
case _ => NoType
897
- def skipPackageObject ( using Context ) : Type =
897
+ def skipPackageObject : Type =
898
898
if tp.typeSymbol.isPackageObject then tp.underlyingPrefix else tp
899
- def underlying ( using Context ) : Type = tp match
899
+ def underlying : Type = tp match
900
900
case tp : TypeProxy => tp.underlying
901
901
case _ => tp
902
902
@@ -913,6 +913,9 @@ object CheckUnused:
913
913
sym.isClass && sym.info.allMembers.forall: d =>
914
914
val m = d.symbol
915
915
! m.isTerm || m.isSelfSym || m.is(Method ) && (m.owner == defn.AnyClass || m.owner == defn.ObjectClass )
916
+ def isEffectivelyPrivate : Boolean =
917
+ sym.is(Private , butNot = ParamAccessor )
918
+ || sym.owner.isAnonymousClass && ! sym.isEffectivelyOverride
916
919
def isEffectivelyOverride : Boolean =
917
920
sym.is(Override )
918
921
||
@@ -921,11 +924,6 @@ object CheckUnused:
921
924
val base = if owner.classInfo.selfInfo != NoType then owner.thisType else owner.info
922
925
base.baseClasses.drop(1 ).iterator.exists(sym.overriddenSymbol(_).exists)
923
926
}
924
- def isEffectivelyPrivate : Boolean =
925
- sym.is(Private , butNot = ParamAccessor )
926
- || sym.owner.isAnonymousClass && ! sym.isEffectivelyOverride
927
- def isEffectivelyOverride (using Context ): Boolean =
928
- sym.is(Override ) || sym.nextOverriddenSymbol.exists
929
927
// pick the symbol the user wrote for purposes of tracking
930
928
inline def userSymbol : Symbol =
931
929
if sym.denot.is(ModuleClass ) then sym.denot.companionModule else sym
@@ -941,21 +939,21 @@ object CheckUnused:
941
939
case untpd.Ident (nme.WILDCARD ) => true
942
940
case _ => false
943
941
944
- extension (imp : Import )
942
+ extension (imp : Import )( using Context )
945
943
/** Is it the first import clause in a statement? `a.x` in `import a.x, b.{y, z}` */
946
- def isPrimaryClause ( using Context ) : Boolean =
944
+ def isPrimaryClause : Boolean =
947
945
imp.srcPos.span.pointDelta > 0 // primary clause starts at `import` keyword with point at clause proper
948
946
949
947
/** Generated import of cases from enum companion. */
950
- def isGeneratedByEnum ( using Context ) : Boolean =
948
+ def isGeneratedByEnum : Boolean =
951
949
imp.symbol.exists && imp.symbol.owner.is(Enum , butNot = Case )
952
950
953
951
/** Under -Wunused:strict-no-implicit-warn, avoid false positives
954
952
* if this selector is a wildcard that might import implicits or
955
953
* specifically does import an implicit.
956
954
* Similarly, import of CanEqual must not warn, as it is always witness.
957
955
*/
958
- def isLoose (sel : ImportSelector )( using Context ) : Boolean =
956
+ def isLoose (sel : ImportSelector ): Boolean =
959
957
if ctx.settings.WunusedHas .strictNoImplicitWarn then
960
958
if sel.isWildcard
961
959
|| imp.expr.tpe.member(sel.name.toTermName).hasAltWith(_.symbol.isOneOf(GivenOrImplicit ))
0 commit comments