@@ -150,19 +150,23 @@ trait SpaceLogic {
150
150
})
151
151
152
152
/** Flatten space to get rid of `Or` for pretty print */
153
- def flatten (space : Space )(using Context ): List [Space ] = space match {
153
+ def flatten (space : Space )(using Context ): Seq [Space ] = space match {
154
154
case Prod (tp, fun, spaces, full) =>
155
- spaces.map(flatten) match {
156
- case Nil => Prod (tp, fun, Nil , full) :: Nil
157
- case ss =>
158
- ss.foldLeft(List [Prod ]()) { (acc, flat) =>
159
- if (acc.isEmpty) flat.map(s => Prod (tp, fun, s :: Nil , full))
160
- else for (Prod (tp, fun, ss, full) <- acc; s <- flat) yield Prod (tp, fun, ss :+ s, full)
161
- }
155
+ val ss = LazyList (spaces : _* ).map(flatten)
156
+ val template = Prod (tp, fun, Nil , full)
157
+ ss.foldLeft(LazyList (template)) { (acc, flat) =>
158
+ for
159
+ Prod (tp, fun, ss, full) <- acc;
160
+ s <- flat
161
+ yield
162
+ Prod (tp, fun, ss :+ s, full)
162
163
}
164
+
163
165
case Or (spaces) =>
164
- spaces.flatMap(flatten _)
165
- case _ => List (space)
166
+ LazyList (spaces : _* ).flatMap(flatten)
167
+
168
+ case _ =>
169
+ List (space)
166
170
}
167
171
168
172
/** Is `a` a subspace of `b`? Equivalent to `a - b == Empty`, but faster */
@@ -838,8 +842,10 @@ class SpaceEngine(using Context) extends SpaceLogic {
838
842
s != Empty && (! checkGADTSAT || satisfiable(s))
839
843
}
840
844
841
- if (uncovered.nonEmpty)
842
- report.warning(PatternMatchExhaustivity (show(uncovered)), sel.srcPos)
845
+
846
+ if uncovered.nonEmpty then
847
+ val hasMore = uncovered.lengthCompare(6 ) > 0
848
+ report.warning(PatternMatchExhaustivity (show(uncovered.take(6 )), hasMore), sel.srcPos)
843
849
}
844
850
845
851
private def redundancyCheckable (sel : Tree ): Boolean =
0 commit comments