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 {
2222
2323 extension (self : Symbol ) {
2424
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+ */
2629 def directlyInheritedTraits (using Context ): List [ClassSymbol ] = {
2730 val superCls = self.asClass.superClass
2831 val baseClasses = self.asClass.baseClasses
2932 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 )
3138 }
3239
3340 /** 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 {
491491 */
492492 def missingTermSymbols : List [Symbol ] =
493493 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
498497 buf.toList
499498
500499 // 2. Check that only abstract classes have deferred members
You can’t perform that action at this time.
0 commit comments