@@ -642,7 +642,7 @@ object SpaceEngine {
642642 // For instance, from i15029, `decompose((X | Y).Field[T]) = [X.Field[T], Y.Field[T]]`.
643643 parts.map(tp.derivedAppliedType(_, targs))
644644
645- case tp if tp.classSymbol. isDecomposableToChildren =>
645+ case tp if tp.isDecomposableToChildren =>
646646 def getChildren (sym : Symbol ): List [Symbol ] =
647647 sym.children.flatMap { child =>
648648 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 {
678678 rec(tp, Nil )
679679 }
680680
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,
683683 * abstract (or a trait) - so its not a sealed concrete class that can be instantiated on its own,
684684 * has no anonymous children, which we wouldn't be able to name as counter-examples,
685685 * but does have children.
@@ -688,7 +688,8 @@ object SpaceEngine {
688688 * A sealed trait with subclasses that then get removed after `refineUsingParent`, decomposes to the empty list.
689689 * So that's why we consider whether a type has children. */
690690 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
692693
693694 val ListOfNoType = List (NoType )
694695 val ListOfTypNoType = ListOfNoType .map(Typ (_, decomposed = true ))
0 commit comments