Skip to content

Commit d5c3a9a

Browse files
committed
Merge commit 'cabf626bbc' into wip/fresh-merge2
2 parents c5503f5 + cabf626 commit d5c3a9a

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

src/library/scala/collection/immutable/List.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ sealed abstract class List[+A] extends AbstractSeq[A]
305305
}
306306
result
307307
}
308+
309+
override def foldRight[B](z: B)(op: (A, B) => B): B =
310+
reverse.foldLeft(z)((right, left) => op(left, right))
308311

309312
override def stringPrefix = "List"
310313

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class V private (val a: Any) extends AnyVal
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
object Test {
2+
// After the first attempt to make seprately compiled value
3+
// classes respect the privacy of constructors, we got:
4+
//
5+
// exception when typing v.a().==(v.a())/class scala.reflect.internal.Trees$Apply
6+
// constructor V in class V cannot be accessed in object Test in file test/files/pos/t6601/UsePrivateValueClass_2.scala
7+
// scala.reflect.internal.Types$TypeError: constructor V in class V cannot be accessed in object Test
8+
def foo(v: V) = v.a == v.a
9+
def bar(v: V) = v == v
10+
}

test/files/run/t2818.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
105
2+
499999500000
3+
0
4+
1

test/files/run/t2818.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object Test extends App {
2+
println((List.range(1L, 15L) :\ 0L) (_ + _))
3+
println((List.range(1L, 1000000L) :\ 0L) (_ + _))
4+
println((List.fill(5)(1) :\ 1) (_ - _))
5+
println((List.fill(1000000)(1) :\ 1) (_ - _))
6+
}

0 commit comments

Comments
 (0)