@@ -44,7 +44,7 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
4444 extension (split : Split )
4545 /** Concatenate two splits. */
4646 def ++ (fallback : Split ): Split =
47- if fallback == Split .Nil then
47+ if fallback == Split .End then
4848 split
4949 else if split.isFull then
5050 raise :
@@ -55,7 +55,7 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
5555 else (split match
5656 case Split .Cons (head, tail) => Split .Cons (head, tail ++ fallback)
5757 case Split .Let (name, term, tail) => Split .Let (name, term, tail ++ fallback)
58- case Split .Else (_) /* impossible */ | Split .Nil => fallback)
58+ case Split .Else (_) /* impossible */ | Split .End => fallback)
5959
6060 import collection .mutable .HashMap
6161
@@ -177,15 +177,15 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
177177 // expand from the N-th to the second match.
178178 lazy val tailSplit =
179179 val innermostSplit = consequent match
180- case L (tree) => termSplit(tree, identity)(Split .Nil )
180+ case L (tree) => termSplit(tree, identity)(Split .End )
181181 case R (tree) => (ctx : Ctx ) => Split .default(term(tree)(using ctx))
182182 tail.foldRight(innermostSplit):
183183 case ((coda, pat), sequel) => ctx => trace(
184184 pre = s " conjunct matches <<< $tail" ,
185185 post = (res : Split ) => s " conjunct matches >>> $res"
186186 ):
187187 nominate(ctx, term(coda)(using ctx)):
188- expandMatch(_, pat, sequel)(Split .Nil )
188+ expandMatch(_, pat, sequel)(Split .End )
189189 // We apply `finish` to the first coda and expand the first match.
190190 // Note that the scrutinee might be not an identifier.
191191 headCoda match
@@ -321,7 +321,7 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
321321 post = (res : Split ) => s " patternSplit (else) >>> ${res.showDbg}"
322322 ):
323323 elabFallback(backup)(ctx) match
324- case Split .Nil => ()
324+ case Split .End => ()
325325 case _ => raise(ErrorReport (msg " Any following branches are unreachable. " -> branch.toLoc :: Nil ))
326326 Split .default(term(body)(using ctx))
327327 case branch => backup => ctx => trace(
@@ -338,12 +338,12 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
338338 // expand from the N-th to the second match.
339339 val tailSplit =
340340 val innermostSplit = consequent match
341- case L (tree) => termSplit(tree, identity)(Split .Nil )
341+ case L (tree) => termSplit(tree, identity)(Split .End )
342342 case R (tree) => (ctx : Ctx ) => Split .default(term(tree)(using ctx))
343343 tail.foldRight(innermostSplit):
344344 case ((coda, pat), sequel) => ctx =>
345345 nominate(ctx, term(coda)(using ctx)):
346- expandMatch(_, pat, sequel)(Split .Nil )
346+ expandMatch(_, pat, sequel)(Split .End )
347347 .traced(
348348 pre = s " conjunct matches <<< $tail" ,
349349 post = (res : Split ) => s " conjunct matches >>> $res" )
@@ -376,7 +376,7 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
376376 // A single variable pattern or constructor pattern without parameters.
377377 case ctor : Ident => fallback => ctx => ctx.get(ctor.name) match
378378 case S (sym : ClassSymbol ) => // TODO: refined
379- Branch (ref, Pattern .Class (sym, N , false )(ctor), sequel(ctx)) : : fallback
379+ Branch (ref, Pattern .Class (sym, N , false )(ctor), sequel(ctx)) ~ : fallback
380380 case S (_ : VarSymbol ) | N =>
381381 // If the identifier refers to a variable or nothing, we interpret it
382382 // as a variable pattern. If `fallback` is not used when `sequel`
@@ -405,8 +405,8 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
405405 Branch (
406406 ref,
407407 Pattern .Class (cls, S (params), false )(ctor), // TODO: refined?
408- subMatches(params zip args, sequel)(Split .Nil )(ctx)
409- ) : : fallback
408+ subMatches(params zip args, sequel)(Split .End )(ctx)
409+ ) ~ : fallback
410410 case _ =>
411411 // Raise an error and discard `sequel`. Use `fallback` instead.
412412 raise(ErrorReport (msg " Unknown constructor ` ${ctor.name}`. " -> ctor.toLoc :: Nil ))
@@ -416,10 +416,10 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
416416 pre = s " expandMatch: literal <<< $literal" ,
417417 post = (r : Split ) => s " expandMatch: literal >>> ${r.showDbg}"
418418 ):
419- Branch (ref, Pattern .LitPat (literal), sequel(ctx)) : : fallback
419+ Branch (ref, Pattern .LitPat (literal), sequel(ctx)) ~ : fallback
420420 // A single pattern in conjunction with more conditions
421421 case pattern and consequent => fallback => ctx =>
422- val innerSplit = termSplit(consequent, identity)(Split .Nil )
422+ val innerSplit = termSplit(consequent, identity)(Split .End )
423423 expandMatch(scrutSymbol, pattern, innerSplit)(fallback)(ctx)
424424 case _ => fallback => _ =>
425425 // Raise an error and discard `sequel`. Use `fallback` instead.
0 commit comments