Skip to content

Commit b31d00e

Browse files
committed
Code refactoring
1 parent 5f910bb commit b31d00e

File tree

1 file changed

+4
-4
lines changed
  • compiler/src/dotty/tools/dotc/transform/patmat

1 file changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,16 +812,16 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
812812
}.apply(false, tp)
813813

814814
def checkExhaustivity(_match: Match): Unit = {
815-
val Match(sel, cases :+ last) = _match
815+
val Match(sel, cases) = _match
816816
val selTyp = sel.tpe.widen.dealias
817817

818818
if (!exhaustivityCheckable(sel)) return
819819

820-
val patternSpace = Or((last :: cases).map({ x =>
820+
val patternSpace = Or(cases.foldLeft(List.empty[Space]) { (acc, x) =>
821821
val space = if (x.guard.isEmpty) project(x.pat) else Empty
822822
debug.println(s"${x.pat.show} ====> ${show(space)}")
823-
space
824-
}))
823+
space :: acc
824+
})
825825

826826
val checkGADTSAT = shouldCheckExamples(selTyp)
827827

0 commit comments

Comments
 (0)