@@ -105,7 +105,7 @@ trait SpaceLogic {
105
105
def signature (unapp : TermRef , scrutineeTp : Type , argLen : Int ): List [Type ]
106
106
107
107
/** Get components of decomposable types */
108
- def decompose (tp : Type ): List [Space ]
108
+ def decompose (tp : Type ): List [Typ ]
109
109
110
110
/** Whether the extractor covers the given type */
111
111
def covers (unapp : TermRef , scrutineeTp : Type ): Boolean
@@ -335,7 +335,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
335
335
case _ => false
336
336
}
337
337
338
- override def intersectUnrelatedAtomicTypes (tp1 : Type , tp2 : Type ): Space = trace(s " atomic intersection: ${AndType (tp1, tp2).show}" , debug) {
338
+ override def intersectUnrelatedAtomicTypes (tp1 : Type , tp2 : Type ): Empty . type | Typ = trace(s " atomic intersection: ${AndType (tp1, tp2).show}" , debug) {
339
339
// Precondition: !isSubType(tp1, tp2) && !isSubType(tp2, tp1).
340
340
if (! ctx.explicitNulls && (tp1.isNullType || tp2.isNullType)) {
341
341
// Since projections of types don't include null, intersection with null is empty.
@@ -589,11 +589,11 @@ class SpaceEngine(using Context) extends SpaceLogic {
589
589
}
590
590
591
591
/** Decompose a type into subspaces -- assume the type can be decomposed */
592
- def decompose (tp : Type ): List [Space ] =
592
+ def decompose (tp : Type ): List [Typ ] =
593
593
tp.dealias match {
594
594
case AndType (tp1, tp2) =>
595
- def decomposeComponent (tpA : Type , tpB : Type ) =
596
- decompose(tpA).asInstanceOf [ List [ Typ ]]. flatMap {
595
+ def decomposeComponent (tpA : Type , tpB : Type ): List [ Typ ] =
596
+ decompose(tpA).flatMap {
597
597
case Typ (tp, _) =>
598
598
if tp <:< tpB then
599
599
Typ (tp, decomposed = true ) :: Nil
@@ -602,7 +602,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
602
602
else
603
603
intersectUnrelatedAtomicTypes(tp, tpB) match
604
604
case Empty => Nil
605
- case space => List (space )
605
+ case typ : Typ => List (typ )
606
606
}
607
607
608
608
if canDecompose(tp1) then
0 commit comments