File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -1953,7 +1953,7 @@ object SymDenotations {
19531953 case _ => NoSymbol
19541954
19551955 /** The explicitly given self type (self types of modules are assumed to be
1956- * explcitly given here).
1956+ * explicitly given here).
19571957 */
19581958 def givenSelfType (using Context ): Type = classInfo.selfInfo match {
19591959 case tp : Type => tp
Original file line number Diff line number Diff line change @@ -926,7 +926,13 @@ object CheckUnused:
926926 sym.is(Private , butNot = ParamAccessor )
927927 || sym.owner.isAnonymousClass && ! sym.isEffectivelyOverride
928928 def isEffectivelyOverride : Boolean =
929- sym.is(Override ) || sym.allOverriddenSymbols.hasNext
929+ sym.is(Override )
930+ ||
931+ sym.canMatchInheritedSymbols && { // inline allOverriddenSymbols using owner.info or thisType
932+ val owner = sym.owner.asClass
933+ val base = if owner.classInfo.selfInfo != NoType then owner.thisType else owner.info
934+ base.baseClasses.drop(1 ).iterator.exists(sym.overriddenSymbol(_).exists)
935+ }
930936 // pick the symbol the user wrote for purposes of tracking
931937 inline def userSymbol : Symbol =
932938 if sym.denot.is(ModuleClass ) then sym.denot.companionModule else sym
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ trait BadMix { self: InterFace =>
122122 a
123123 }
124124 override def call (a : Int ,
125- XXXX : String , // warn no longer excused because required by superclass
125+ XXXX : String , // no warn still excused because override ( required by self type)
126126 c : Double ): Int = {
127127 println(c)
128128 a
@@ -135,6 +135,14 @@ trait BadMix { self: InterFace =>
135135 def i (implicit s : String ) = answer // warn
136136}
137137
138+ trait ImplFace :
139+ self : InterFace =>
140+ def call (a : Int ,
141+ b : String , // no warn required by self type
142+ c : Double ): Int =
143+ println(c)
144+ a
145+
138146class Unequal {
139147 override def equals (other : Any ) = toString.nonEmpty // no warn (override)
140148}
You can’t perform that action at this time.
0 commit comments