We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 541908f commit 35b319aCopy full SHA for 35b319a
compiler/src/dotty/tools/dotc/core/Decorators.scala
@@ -112,12 +112,11 @@ object Decorators {
112
else x1 :: xs1
113
}
114
115
- def foldRightBN[U](z: => U)(op: (T, => U) => U): U = {
116
- @tailrec def foldLeftBN(xs: List[T], acc: => U): U = xs match {
117
- case x :: xs1 => foldLeftBN(xs1, op(x, acc))
118
- case Nil => acc
119
- }
120
- foldLeftBN(xs.reverse, z)
+ def foldRightBN[U](z: => U)(op: (T, => U) => U): U = xs.reverse.foldLeftBN(z)(op)
+
+ @tailrec final def foldLeftBN[U](z: => U)(op: (T, => U) => U): U = xs match {
+ case Nil => z
+ case x :: xs1 => xs1.foldLeftBN(op(x, z))(op)
121
122
123
final def hasSameLengthAs[U](ys: List[U]): Boolean = {
0 commit comments