Skip to content

Commit 8736ff8

Browse files
som-snytttgodzik
authored andcommitted
Always trust override modifier
[Cherry-picked 1da6599]
1 parent c637007 commit 8736ff8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/transform/CheckUnused.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ object CheckUnused:
581581
end checkExplicit
582582
// begin
583583
if !infos.skip(m)
584-
&& !m.nextOverriddenSymbol.exists
584+
&& !m.isEffectivelyOverride
585585
&& !allowed
586586
then
587587
checkExplicit()
@@ -923,7 +923,9 @@ object CheckUnused:
923923
}
924924
def isEffectivelyPrivate: Boolean =
925925
sym.is(Private, butNot = ParamAccessor)
926-
|| sym.owner.isAnonymousClass && !sym.is(Override) && !sym.nextOverriddenSymbol.exists
926+
|| sym.owner.isAnonymousClass && !sym.isEffectivelyOverride
927+
def isEffectivelyOverride(using Context): Boolean =
928+
sym.is(Override) || sym.nextOverriddenSymbol.exists
927929
// pick the symbol the user wrote for purposes of tracking
928930
inline def userSymbol: Symbol=
929931
if sym.denot.is(ModuleClass) then sym.denot.companionModule else sym

0 commit comments

Comments
 (0)