Skip to content

Commit a28b792

Browse files
committed
Update SeqView.updated
1 parent 31da834 commit a28b792

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

scala2-library-cc/src/scala/collection/Seq.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ trait SeqOps[+A, +CC[_], +C] extends Any with SeqViewOps[A, CC, C] { self =>
957957
* lazy collection this exception may be thrown at a later time or not at
958958
* all (if the end of the collection is never evaluated).
959959
*/
960-
def updated[B >: A](index: Int, elem: B): CC[B] = {
960+
override def updated[B >: A](index: Int, elem: B): CC[B] = {
961961
if(index < 0) throw new IndexOutOfBoundsException(index.toString)
962962
val k = knownSize
963963
if(k >= 0 && index >= k) throw new IndexOutOfBoundsException(index.toString)

scala2-library-cc/src/scala/collection/SeqView.scala

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@ trait SeqViewOps[+A, +CC[_], +C] extends Any with IterableOps[A, CC, C] {
3030
def length: Int
3131
def apply(x: Int): A
3232
def appended[B >: A](elem: B): CC[B]^{this}
33-
def updated[B >: A](index: Int, elem: B): CC[B]^{this}
3433
def prepended[B >: A](elem: B): CC[B]^{this}
3534
def reverse: C^{this}
3635
def sorted[B >: A](implicit ord: Ordering[B]): C^{this}
3736

37+
// Placeholder implementation for that method in SeqOps.
38+
// This is needed due to the change in the class hierarchy in cc stdlib.
39+
// See #19660 and #19819.
40+
def updated[B >: A](index: Int, elem: B): CC[B]^{this} =
41+
assert(false, "This is a placeholder implementation in the capture checked Scala 2 library.")
42+
???
43+
3844
def reverseIterator: Iterator[A]^{this} = reversed.iterator
3945
}
4046

@@ -46,15 +52,6 @@ trait SeqView[+A] extends SeqViewOps[A, View, View[A]] with View[A] {
4652
override def map[B](f: A => B): SeqView[B]^{this, f} = new SeqView.Map(this, f)
4753
override def appended[B >: A](elem: B): SeqView[B]^{this} = new SeqView.Appended(this, elem)
4854

49-
// Copied from SeqOps. This is needed due to the change of class hierarchy in stdlib.
50-
// See #19660.
51-
override def updated[B >: A](index: Int, elem: B): View[B]^{this} = {
52-
if(index < 0) throw new IndexOutOfBoundsException(index.toString)
53-
val k = knownSize
54-
if(k >= 0 && index >= k) throw new IndexOutOfBoundsException(index.toString)
55-
iterableFactory.from(new View.Updated(this, index, elem))
56-
}
57-
5855
override def prepended[B >: A](elem: B): SeqView[B]^{this} = new SeqView.Prepended(elem, this)
5956
override def reverse: SeqView[A]^{this} = new SeqView.Reverse(this)
6057
override def take(n: Int): SeqView[A]^{this} = new SeqView.Take(this, n)

0 commit comments

Comments
 (0)