We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 795ecf5 commit 265dfa1Copy full SHA for 265dfa1
compiler/src/dotty/tools/dotc/transform/patmat/Space.scala
@@ -599,10 +599,10 @@ class SpaceEngine(using Context) extends SpaceLogic {
599
Typ(tp, decomposed = true) :: Nil
600
else if tpB <:< tp then
601
Typ(tpB, decomposed = true) :: Nil
602
+ else if TypeComparer.provablyDisjoint(tp, tpB) then
603
+ Nil
604
else
- intersectUnrelatedAtomicTypes(tp, tpB) match
- case Empty => Nil
605
- case typ: Typ => List(typ)
+ Typ(AndType(tp1, tp2), decomposed = true) :: Nil
606
}
607
608
if canDecompose(tp1) then
tests/patmat/i10667.scala
@@ -0,0 +1,15 @@
1
+sealed trait A
2
+
3
+enum Nums {
4
+ case One
5
+ case Two extends Nums with A
6
+ case Three
7
+}
8
9
+object Test {
10
+ val list = List[Nums & A](Nums.Two)
11
12
+ list.map {
13
+ case Nums.Two => ()
14
+ }
15
0 commit comments