We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ec71b47 + 6926796 commit 2118a0cCopy full SHA for 2118a0c
compiler/src/dotty/tools/dotc/core/Decorators.scala
@@ -112,9 +112,12 @@ object Decorators {
112
else x1 :: xs1
113
}
114
115
- def foldRightBN[U](z: => U)(op: (T, => U) => U): U = xs match {
116
- case Nil => z
117
- 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))
118
+ case Nil => acc
119
+ }
120
+ foldLeftBN(xs.reverse, z)
121
122
123
final def hasSameLengthAs[U](ys: List[U]): Boolean = {
0 commit comments