summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-02-01 17:41:05 -0800
committerPaul Phillips <paulp@improving.org>2013-02-01 17:41:05 -0800
commitd5c3a9acf1ba194abc89e210cb5611db905e37c3 (patch)
treefd5835652a3f8e43ec4c59aaa68e2a0d82751f10
parentc5503f5e750086a72396c8dc860c2dadad5efc7f (diff)
parentcabf626bbc49a897e581fbf6ceaa79ffb191bfec (diff)
downloadscala-d5c3a9acf1ba194abc89e210cb5611db905e37c3.tar.gz
scala-d5c3a9acf1ba194abc89e210cb5611db905e37c3.tar.bz2
scala-d5c3a9acf1ba194abc89e210cb5611db905e37c3.zip
Merge commit 'cabf626bbc' into wip/fresh-merge2
-rw-r--r--src/library/scala/collection/immutable/List.scala3
-rw-r--r--test/files/pos/t6601/PrivateValueClass_1.scala1
-rw-r--r--test/files/pos/t6601/UsePrivateValueClass_2.scala10
-rw-r--r--test/files/run/t2818.check4
-rw-r--r--test/files/run/t2818.scala6
5 files changed, 24 insertions, 0 deletions
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index aeaa479e2f..654ed0286a 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -305,6 +305,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/pos/t6601/PrivateValueClass_1.scala b/test/files/pos/t6601/PrivateValueClass_1.scala
new file mode 100644
index 0000000000..85c3687137
--- /dev/null
+++ b/test/files/pos/t6601/PrivateValueClass_1.scala
@@ -0,0 +1 @@
+class V private (val a: Any) extends AnyVal \ No newline at end of file
diff --git a/test/files/pos/t6601/UsePrivateValueClass_2.scala b/test/files/pos/t6601/UsePrivateValueClass_2.scala
new file mode 100644
index 0000000000..461b8397b2
--- /dev/null
+++ b/test/files/pos/t6601/UsePrivateValueClass_2.scala
@@ -0,0 +1,10 @@
+object Test {
+ // After the first attempt to make seprately compiled value
+ // classes respect the privacy of constructors, we got:
+ //
+ // exception when typing v.a().==(v.a())/class scala.reflect.internal.Trees$Apply
+ // constructor V in class V cannot be accessed in object Test in file test/files/pos/t6601/UsePrivateValueClass_2.scala
+ // scala.reflect.internal.Types$TypeError: constructor V in class V cannot be accessed in object Test
+ def foo(v: V) = v.a == v.a
+ def bar(v: V) = v == v
+}
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) (_ - _))
+}