File tree Expand file tree Collapse file tree 2 files changed +9
-19
lines changed Expand file tree Collapse file tree 2 files changed +9
-19
lines changed Original file line number Diff line number Diff line change @@ -647,7 +647,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
647
647
}
648
648
def parentSymbols : List [Symbol ] = toDenot(sym).info.parents.map(_.typeSymbol)
649
649
def superClass : Symbol = {
650
- val t = toDenot(sym).superClass
650
+ val t = toDenot(sym).asClass. superClass
651
651
if (t.exists) t
652
652
else if (sym is Flags .ModuleClass ) {
653
653
// workaround #371
@@ -712,7 +712,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
712
712
* All interfaces implemented by a class, except for those inherited through the superclass.
713
713
*
714
714
*/
715
- def superInterfaces : List [Symbol ] = decorateSymbol(sym).superInterfaces
715
+ def superInterfaces : List [Symbol ] = decorateSymbol(sym).directlyInheritedTraits
716
716
717
717
/**
718
718
* True for module classes of package level objects. The backend will generate a mirror class for
Original file line number Diff line number Diff line change @@ -24,30 +24,20 @@ object SymUtils {
24
24
class SymUtils (val self : Symbol ) extends AnyVal {
25
25
import SymUtils ._
26
26
27
- def superClass (implicit ctx : Context ) = {
28
- val parents = self.asClass.classInfo.parents
29
- if (parents.isEmpty) NoSymbol
30
- else parents.head.symbol
31
- }
32
-
33
-
34
- /**
35
- * For a class: All interfaces implemented by a class except for those inherited through the superclass.
36
- * For a trait: all parent traits
37
- */
38
-
39
- def superInterfaces (implicit ctx : Context ) = {
40
- val superCls = self.superClass
27
+ /** All traits implemented by a class or trait except for those inherited through the superclass. */
28
+ def directlyInheritedTraits (implicit ctx : Context ) = {
29
+ val superCls = self.asClass.superClass
41
30
val baseClasses = self.asClass.baseClasses
42
31
if (baseClasses.isEmpty) Nil
43
32
else baseClasses.tail.takeWhile(_ ne superCls).reverse
44
-
45
33
}
46
34
47
- /** All interfaces implemented by a class, except for those inherited through the superclass. */
35
+ /** All traits implemented by a class, except for those inherited through the superclass.
36
+ * The empty list if `self` is a trait.
37
+ */
48
38
def mixins (implicit ctx : Context ) = {
49
39
if (self is Trait ) Nil
50
- else superInterfaces
40
+ else directlyInheritedTraits
51
41
}
52
42
53
43
def isTypeTestOrCast (implicit ctx : Context ): Boolean =
You can’t perform that action at this time.
0 commit comments