Skip to content

Commit

Permalink
Merge pull request #3078 from allanrenucci/0.3.x
Browse files Browse the repository at this point in the history
Backport #3076
  • Loading branch information
allanrenucci authored Sep 6, 2017
2 parents ec71b47 + 6926796 commit 2118a0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions compiler/src/dotty/tools/dotc/core/Decorators.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,12 @@ object Decorators {
else x1 :: xs1
}

def foldRightBN[U](z: => U)(op: (T, => U) => U): U = xs match {
case Nil => z
case x :: xs1 => op(x, xs1.foldRightBN(z)(op))
def foldRightBN[U](z: => U)(op: (T, => U) => U): U = {
@tailrec def foldLeftBN(xs: List[T], acc: => U): U = xs match {
case x :: xs1 => foldLeftBN(xs1, op(x, acc))
case Nil => acc
}
foldLeftBN(xs.reverse, z)
}

final def hasSameLengthAs[U](ys: List[U]): Boolean = {
Expand Down

0 comments on commit 2118a0c

Please sign in to comment.