File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -924,7 +924,7 @@ object CheckUnused:
924924 ! m.isTerm || m.isSelfSym || m.is(Method ) && (m.owner == defn.AnyClass || m.owner == defn.ObjectClass )
925925 def isEffectivelyPrivate (using Context ): Boolean =
926926 sym.is(Private , butNot = ParamAccessor )
927- || sym.owner.isAnonymousClass && ! sym.nextOverriddenSymbol.exists
927+ || sym.owner.isAnonymousClass && ! sym.is( Override ) && ! sym. nextOverriddenSymbol.exists
928928 // pick the symbol the user wrote for purposes of tracking
929929 inline def userSymbol (using Context ): Symbol =
930930 if sym.denot.is(ModuleClass ) then sym.denot.companionModule else sym
Original file line number Diff line number Diff line change 1+
2+ public class J {
3+ private int i = 42 ;
4+ public int i () { return 27 ; }
5+ public String i (int j ) { return "hello, world" ; }
6+ }
Original file line number Diff line number Diff line change 1+ //> using options -Werror -Wunused:privates
2+
3+ def f =
4+ new J :
5+ override val i = - 1 // nowarn, trust override
6+
7+ def g =
8+ new J :
9+ override def i = - 1 // nowarn, trust override
10+
11+ def h =
12+ new J :
13+ override def i () = - 1 // nowarn correctly matches signature
You can’t perform that action at this time.
0 commit comments