File tree 3 files changed +17
-3
lines changed
compiler/src/dotty/tools/dotc
3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -1953,7 +1953,7 @@ object SymDenotations {
1953
1953
case _ => NoSymbol
1954
1954
1955
1955
/** The explicitly given self type (self types of modules are assumed to be
1956
- * explcitly given here).
1956
+ * explicitly given here).
1957
1957
*/
1958
1958
def givenSelfType (using Context ): Type = classInfo.selfInfo match {
1959
1959
case tp : Type => tp
Original file line number Diff line number Diff line change @@ -926,7 +926,13 @@ object CheckUnused:
926
926
sym.is(Private , butNot = ParamAccessor )
927
927
|| sym.owner.isAnonymousClass && ! sym.isEffectivelyOverride
928
928
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
+ }
930
936
// pick the symbol the user wrote for purposes of tracking
931
937
inline def userSymbol : Symbol =
932
938
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 =>
122
122
a
123
123
}
124
124
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)
126
126
c : Double ): Int = {
127
127
println(c)
128
128
a
@@ -135,6 +135,14 @@ trait BadMix { self: InterFace =>
135
135
def i (implicit s : String ) = answer // warn
136
136
}
137
137
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
+
138
146
class Unequal {
139
147
override def equals (other : Any ) = toString.nonEmpty // no warn (override)
140
148
}
You can’t perform that action at this time.
0 commit comments