From ae37dcc9b5cecc522ab22abb55c54d3fe8295025 Mon Sep 17 00:00:00 2001 From: Liu Fengyun Date: Fri, 21 May 2021 08:49:21 +0200 Subject: [PATCH] Fix CI --- .../dotty/tools/dotc/transform/patmat/Space.scala | 6 +++--- tests/patmat/i10667.scala | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 tests/patmat/i10667.scala diff --git a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala index 7cd700c53821..9c27d0aeead3 100644 --- a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala +++ b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala @@ -599,10 +599,10 @@ class SpaceEngine(using Context) extends SpaceLogic { Typ(tp, decomposed = true) :: Nil else if tpB <:< tp then Typ(tpB, decomposed = true) :: Nil + else if TypeComparer.provablyDisjoint(tp, tpB) then + Nil else - intersectUnrelatedAtomicTypes(tp, tpB) match - case Empty => Nil - case typ: Typ => List(typ) + Typ(AndType(tp, tpB), decomposed = true) :: Nil } if canDecompose(tp1) then diff --git a/tests/patmat/i10667.scala b/tests/patmat/i10667.scala new file mode 100644 index 000000000000..fde5021929fc --- /dev/null +++ b/tests/patmat/i10667.scala @@ -0,0 +1,15 @@ +sealed trait A + +enum Nums { + case One + case Two extends Nums with A + case Three +} + +object Test { + val list = List[Nums & A](Nums.Two) + + list.map { + case Nums.Two => () + } +}