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