@@ -90,16 +90,10 @@ class Desugarer(val elaborator: Elaborator)
90
90
def ++ (fallback : Split ): Split =
91
91
if fallback == Split .End then
92
92
split
93
- else if split.isFull then
94
- raise :
95
- ErrorReport :
96
- msg " The following branches are unreachable. " -> fallback.toLoc ::
97
- msg " Because the previous split is full. " -> split.toLoc :: Nil
98
- split
99
93
else (split match
100
94
case Split .Cons (head, tail) => Split .Cons (head, tail ++ fallback)
101
95
case Split .Let (name, term, tail) => Split .Let (name, term, tail ++ fallback)
102
- case Split .Else (_) /* impossible */ | Split .End => fallback)
96
+ case Split .Else (_) | Split .End => fallback)
103
97
104
98
private val subScrutineeMap = HashMap .empty[BlockLocalSymbol , ScrutineeData ]
105
99
private val fieldScrutineeMap = HashMap .empty[BlockLocalSymbol , ScrutineeData ]
@@ -466,9 +460,7 @@ class Desugarer(val elaborator: Elaborator)
466
460
if pat.patternParams.size > 0 then
467
461
error(
468
462
msg " Pattern ` ${pat.nme}` expects ${" pattern argument" .pluralize(pat.patternParams.size, true )}" ->
469
- pat.patternParams.foldLeft[Opt [Loc ]](N ):
470
- case (N , param) => param.sym.toLoc
471
- case (S (loc), param) => S (loc ++ param.sym.toLoc),
463
+ Loc (pat.patternParams.iterator.map(_.sym)),
472
464
msg " But no arguments were given " -> ctor.toLoc)
473
465
fallback
474
466
else
@@ -515,12 +507,8 @@ class Desugarer(val elaborator: Elaborator)
515
507
if pat.patternParams.size != patArgs.size then
516
508
error(
517
509
msg " Pattern ` ${pat.nme}` expects ${" pattern argument" .pluralize(pat.patternParams.size, true )}" ->
518
- pat.patternParams.foldLeft[Opt [Loc ]](N ):
519
- case (N , param) => param.sym.toLoc
520
- case (S (loc), param) => S (loc ++ param.sym.toLoc),
521
- msg " But ${" pattern argument" .pluralize(patArgs.size, true )} were given " -> args.foldLeft[Opt [Loc ]](N ):
522
- case (N , arg) => arg.toLoc
523
- case (S (loc), arg) => S (loc ++ arg.toLoc))
510
+ Loc (pat.patternParams.iterator.map(_.sym)),
511
+ msg " But ${" pattern argument" .pluralize(patArgs.size, true )} were given " -> Loc (args))
524
512
fallback
525
513
else
526
514
Branch (ref, Pattern .Synonym (pat, patArgs.zip(args)), sequel(ctx)) ~: fallback
0 commit comments