File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,19 @@ object SymUtils {
22
22
23
23
extension (self : Symbol ) {
24
24
25
- /** All traits implemented by a class or trait except for those inherited through the superclass. */
25
+ /** All traits implemented by a class or trait except for those inherited
26
+ * through the superclass. Traits are given in the order they appear in the
27
+ * parents clause (which is the reverse of their order in baseClasses)
28
+ */
26
29
def directlyInheritedTraits (using Context ): List [ClassSymbol ] = {
27
30
val superCls = self.asClass.superClass
28
31
val baseClasses = self.asClass.baseClasses
29
32
if (baseClasses.isEmpty) Nil
30
- else baseClasses.tail.takeWhile(_ ne superCls).reverse
33
+ else
34
+ def recur (bcs : List [ClassSymbol ], acc : List [ClassSymbol ]): List [ClassSymbol ] = bcs match
35
+ case bc :: bcs1 => if bc eq superCls then acc else recur(bcs1, bc :: acc)
36
+ case nil => acc
37
+ recur(baseClasses.tail, Nil )
31
38
}
32
39
33
40
/** All traits implemented by a class, except for those inherited through the superclass.
Original file line number Diff line number Diff line change @@ -491,10 +491,9 @@ object RefChecks {
491
491
*/
492
492
def missingTermSymbols : List [Symbol ] =
493
493
val buf = new mutable.ListBuffer [Symbol ]
494
- for bc <- clazz.baseClasses
495
- sym <- bc.info.decls.toList
496
- if sym.is(DeferredTerm ) && ! isImplemented(sym) && ! ignoreDeferred(sym)
497
- do buf += sym
494
+ for bc <- clazz.baseClasses; sym <- bc.info.decls.toList do
495
+ if sym.is(DeferredTerm ) && ! isImplemented(sym) && ! ignoreDeferred(sym)
496
+ buf += sym
498
497
buf.toList
499
498
500
499
// 2. Check that only abstract classes have deferred members
You can’t perform that action at this time.
0 commit comments