@@ -212,14 +212,20 @@ trait SpaceLogic {
212
212
if (isSubType(tp2, tp1)) b
213
213
else if (canDecompose(tp1)) tryDecompose1(tp1)
214
214
else if (isSubType(tp1, tp2)) a // problematic corner case: inheriting a case class
215
- else intersectUnrelatedAtomicTypes(tp1, tp2)
215
+ else intersectUnrelatedAtomicTypes(tp1, tp2) match
216
+ case Typ (tp, _) => Prod (tp, fun, ss)
217
+ case sp => sp
216
218
case (Prod (tp1, fun, ss), Typ (tp2, _)) =>
217
219
if (isSubType(tp1, tp2)) a
218
220
else if (canDecompose(tp2)) tryDecompose2(tp2)
219
221
else if (isSubType(tp2, tp1)) a // problematic corner case: inheriting a case class
220
- else intersectUnrelatedAtomicTypes(tp1, tp2)
222
+ else intersectUnrelatedAtomicTypes(tp1, tp2) match
223
+ case Typ (tp, _) => Prod (tp, fun, ss)
224
+ case sp => sp
221
225
case (Prod (tp1, fun1, ss1), Prod (tp2, fun2, ss2)) =>
222
- if (! isSameUnapply(fun1, fun2)) intersectUnrelatedAtomicTypes(tp1, tp2)
226
+ if (! isSameUnapply(fun1, fun2)) intersectUnrelatedAtomicTypes(tp1, tp2) match
227
+ case Typ (tp, _) => Prod (tp, fun1, ss1)
228
+ case sp => sp
223
229
else if (ss1.zip(ss2).exists(p => simplify(intersect(p._1, p._2)) == Empty )) Empty
224
230
else Prod (tp1, fun1, ss1.zip(ss2).map((intersect _).tupled))
225
231
}
0 commit comments