Skip to content

Commit 20391ec

Browse files
Rewrite fold
1 parent 7a3146a commit 20391ec

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

compiler/src/dotty/tools/dotc/transform/FirstTransform.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,8 @@ class FirstTransform extends MiniPhaseTransform with InfoTransformer with Annota
9999
def reorder(stats: List[Tree], revPrefix: List[Tree]): List[Tree] = stats match {
100100
case (stat: TypeDef) :: stats1 if stat.symbol.isClass =>
101101
if (stat.symbol is Flags.Module) {
102-
def pushOnTop(xs: List[Tree], ys: List[Tree]): List[Tree] = xs match {
103-
case x :: xs1 => pushOnTop(xs1, x :: ys)
104-
case Nil => ys
105-
}
102+
def pushOnTop(xs: List[Tree], ys: List[Tree]): List[Tree] =
103+
(ys /: xs)((ys, x) => x :: ys)
106104
moduleClassDefs += (stat.name -> stat)
107105
singleClassDefs -= stat.name.stripModuleClassSuffix
108106
val stats1r = reorder(stats1, Nil)

0 commit comments

Comments
 (0)