@@ -638,7 +638,7 @@ object SpaceEngine {
638
638
// For instance, from i15029, `decompose((X | Y).Field[T]) = [X.Field[T], Y.Field[T]]`.
639
639
parts.map(tp.derivedAppliedType(_, targs))
640
640
641
- case tp if tp.classSymbol. isDecomposableToChildren =>
641
+ case tp if tp.isDecomposableToChildren =>
642
642
def getChildren (sym : Symbol ): List [Symbol ] =
643
643
sym.children.flatMap { child =>
644
644
if child eq sym then List (sym) // i3145: sealed trait Baz, val x = new Baz {}, Baz.children returns Baz...
@@ -674,8 +674,8 @@ object SpaceEngine {
674
674
rec(tp, Nil )
675
675
}
676
676
677
- extension (cls : Symbol )
678
- /** A type is decomposable to children if it's sealed,
677
+ extension (tp : Type )
678
+ /** A type is decomposable to children if it has a simple kind, it 's sealed,
679
679
* abstract (or a trait) - so its not a sealed concrete class that can be instantiated on its own,
680
680
* has no anonymous children, which we wouldn't be able to name as counter-examples,
681
681
* but does have children.
@@ -684,7 +684,8 @@ object SpaceEngine {
684
684
* A sealed trait with subclasses that then get removed after `refineUsingParent`, decomposes to the empty list.
685
685
* So that's why we consider whether a type has children. */
686
686
def isDecomposableToChildren (using Context ): Boolean =
687
- cls.is(Sealed ) && cls.isOneOf(AbstractOrTrait ) && ! cls.hasAnonymousChild && cls.children.nonEmpty
687
+ val cls = tp.classSymbol
688
+ tp.hasSimpleKind && cls.is(Sealed ) && cls.isOneOf(AbstractOrTrait ) && ! cls.hasAnonymousChild && cls.children.nonEmpty
688
689
689
690
val ListOfNoType = List (NoType )
690
691
val ListOfTypNoType = ListOfNoType .map(Typ (_, decomposed = true ))
0 commit comments