From d88a280c56a7edb0a226820eba43dbbb9085e84e Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 31 Jul 2016 10:17:59 +0200 Subject: Fix problem with IndexedView.iterator.length --- src/strawman/collections/CollectionStrawMan6.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/strawman') diff --git a/src/strawman/collections/CollectionStrawMan6.scala b/src/strawman/collections/CollectionStrawMan6.scala index 654228c5b..50de63488 100644 --- a/src/strawman/collections/CollectionStrawMan6.scala +++ b/src/strawman/collections/CollectionStrawMan6.scala @@ -886,11 +886,11 @@ object CollectionStrawMan6 extends LowPriority { } /** View defined in terms of indexing a range */ - trait IndexedView[+A] extends View[A] with ArrayLike[A] { + trait IndexedView[+A] extends View[A] with ArrayLike[A] { self => def iterator: Iterator[A] = new Iterator[A] { private var current = 0 - def hasNext = current < length + def hasNext = current < self.length def next: A = { val r = apply(current) current += 1 @@ -908,7 +908,7 @@ object CollectionStrawMan6 extends LowPriority { class Take[A](underlying: IndexedView[A], n: Int) extends View.Take(underlying, n) with IndexedView[A] { - override def iterator = super.iterator + override def iterator = super.iterator // needed to avoid "conflicting overrides" error def length = underlying.length min normN def apply(i: Int) = underlying.apply(i) } -- cgit v1.2.3