diff options
-rw-r--r-- | src/library/scala/collection/immutable/List.scala | 3 | ||||
-rw-r--r-- | test/files/run/t2818.check | 4 | ||||
-rw-r--r-- | test/files/run/t2818.scala | 6 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index 56e386ad67..55ac3995e9 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -295,6 +295,9 @@ sealed abstract class List[+A] extends AbstractSeq[A] } result } + + override def foldRight[B](z: B)(op: (A, B) => B): B = + reverse.foldLeft(z)((right, left) => op(left, right)) override def stringPrefix = "List" diff --git a/test/files/run/t2818.check b/test/files/run/t2818.check new file mode 100644 index 0000000000..31286c990b --- /dev/null +++ b/test/files/run/t2818.check @@ -0,0 +1,4 @@ +105 +499999500000 +0 +1 diff --git a/test/files/run/t2818.scala b/test/files/run/t2818.scala new file mode 100644 index 0000000000..19b67cbc88 --- /dev/null +++ b/test/files/run/t2818.scala @@ -0,0 +1,6 @@ +object Test extends App { + println((List.range(1L, 15L) :\ 0L) (_ + _)) + println((List.range(1L, 1000000L) :\ 0L) (_ + _)) + println((List.fill(5)(1) :\ 1) (_ - _)) + println((List.fill(1000000)(1) :\ 1) (_ - _)) +} |