@@ -659,17 +659,15 @@ object SpaceEngine {
659
659
}
660
660
661
661
extension (tp : Type )
662
- /** A type is decomposable to children if it has a simple kind, it's sealed,
663
- * abstract (or a trait) - so its not a sealed concrete class that can be instantiated on its own,
664
- * has no anonymous children, which we wouldn't be able to name as counter-examples,
665
- * but does have children.
666
- *
667
- * A sealed trait with no subclasses is considered not decomposable and thus is treated as an opaque type.
668
- * A sealed trait with subclasses that then get removed after `refineUsingParent`, decomposes to the empty list.
669
- * So that's why we consider whether a type has children. */
670
662
def isDecomposableToChildren (using Context ): Boolean =
671
- val cls = tp.classSymbol
672
- tp.hasSimpleKind && cls.is(Sealed ) && cls.isOneOf(AbstractOrTrait ) && ! cls.hasAnonymousChild && cls.children.nonEmpty
663
+ val sym = tp.typeSymbol // e.g. Foo[List[Int]] = type Foo (i19275)
664
+ val cls = tp.classSymbol // e.g. Foo[List[Int]] = class List
665
+ tp.hasSimpleKind // can't decompose higher-kinded types
666
+ && cls.is(Sealed )
667
+ && cls.isOneOf(AbstractOrTrait ) // ignore sealed non-abstract classes
668
+ && ! cls.hasAnonymousChild // can't name anonymous classes as counter-examples
669
+ && cls.children.nonEmpty // can't decompose without children
670
+ && ! sym.isOpaqueAlias // can't instantiate subclasses to conform to an opaque type (i19275)
673
671
674
672
val ListOfNoType = List (NoType )
675
673
val ListOfTypNoType = ListOfNoType .map(Typ (_, decomposed = true ))
0 commit comments