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 @@ -923,7 +923,7 @@ object CheckUnused:
923
923
}
924
924
def isEffectivelyPrivate : Boolean =
925
925
sym.is(Private , butNot = ParamAccessor )
926
- || sym.owner.isAnonymousClass && ! sym.nextOverriddenSymbol.exists
926
+ || sym.owner.isAnonymousClass && ! sym.is( Override ) && ! sym. nextOverriddenSymbol.exists
927
927
// pick the symbol the user wrote for purposes of tracking
928
928
inline def userSymbol : Symbol =
929
929
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