From cc5e79c9ec9cea8d0f22020b528877d8f6e00153 Mon Sep 17 00:00:00 2001 From: Gilles Dubochet Date: Wed, 27 May 2009 19:35:02 +0000 Subject: In "Iterable" and in all its subclasses, "itera... In "Iterable" and in all its subclasses, "iterator" replaces "elements" (and assorted changes). --- test/files/pos/bounds.scala | 2 +- test/files/pos/bug1090.scala | 4 ++-- test/files/pos/bug247.scala | 2 +- test/files/pos/bug927.scala | 2 +- test/files/pos/cyclics.scala | 4 ++-- test/files/pos/tcpoly_seq.scala | 12 ++++++------ test/files/pos/tcpoly_seq_typealias.scala | 12 ++++++------ 7 files changed, 19 insertions(+), 19 deletions(-) (limited to 'test/files/pos') diff --git a/test/files/pos/bounds.scala b/test/files/pos/bounds.scala index 5bc5cf89dc..cfea4626c3 100644 --- a/test/files/pos/bounds.scala +++ b/test/files/pos/bounds.scala @@ -7,5 +7,5 @@ class ListMap[A, +B] extends Map[A, B] {} object ListMap { def empty[X, Y] = new ListMap[X, Y] - def apply[A1, B2](elems: Pair[A1, B2]*): Map[A1, B2] = empty[A1,B2].++(elems.elements) + def apply[A1, B2](elems: Pair[A1, B2]*): Map[A1, B2] = empty[A1,B2].++(elems.iterator) } diff --git a/test/files/pos/bug1090.scala b/test/files/pos/bug1090.scala index 69f757fe34..044e327e89 100644 --- a/test/files/pos/bug1090.scala +++ b/test/files/pos/bug1090.scala @@ -1,7 +1,7 @@ object Test { trait Manager { type Node; - def elements : Iterator[Node] + def iterator : Iterator[Node] } trait Core { type Node; @@ -9,7 +9,7 @@ object Test { trait Manager extends Test.Manager { type Node = Core.this.Node } - def f(manager : Manager) = manager.elements.foreach{ + def f(manager : Manager) = manager.iterator.foreach{ case node : NodeImpl => } } diff --git a/test/files/pos/bug247.scala b/test/files/pos/bug247.scala index e2655c6ab3..e976404e61 100644 --- a/test/files/pos/bug247.scala +++ b/test/files/pos/bug247.scala @@ -21,6 +21,6 @@ class TreeMap[KEY,VALUE](_factory:TreeMapFactory[KEY]) extends Tree[KEY,Pair[KEY val order = _factory.order; def this(newOrder:Order[KEY]) = this(new TreeMapFactory[KEY](newOrder)); def get(key:KEY) = null; - def elements:Iterator[Pair[KEY,VALUE]] = null; + def iterator:Iterator[Pair[KEY,VALUE]] = null; override def size = super[Tree].size } diff --git a/test/files/pos/bug927.scala b/test/files/pos/bug927.scala index 5887aba255..7d4c59d94c 100644 --- a/test/files/pos/bug927.scala +++ b/test/files/pos/bug927.scala @@ -5,7 +5,7 @@ object Test { case Stream.Empty => 0 case Stream.cons(hd, tl) => hd + sum(tl) } - val str: Stream[Int] = Stream.fromIterator(List(1,2,3).elements) + val str: Stream[Int] = Stream.fromIterator(List(1,2,3).iterator) assert(sum(str) == 6) } diff --git a/test/files/pos/cyclics.scala b/test/files/pos/cyclics.scala index a49f4faaca..395e88815a 100644 --- a/test/files/pos/cyclics.scala +++ b/test/files/pos/cyclics.scala @@ -12,11 +12,11 @@ trait IterableTemplate { type Constr <: IterableTemplate type ConstrOf[A] = Constr { type Elem = A } - def elements: Iterator[Elem] + def iterator: Iterator[Elem] def map [B] (f: Elem => B): ConstrOf[B] - def foreach(f: Elem => Unit) = elements.foreach(f) + def foreach(f: Elem => Unit) = iterator.foreach(f) } diff --git a/test/files/pos/tcpoly_seq.scala b/test/files/pos/tcpoly_seq.scala index f776ce3fe4..48b3e1ce52 100644 --- a/test/files/pos/tcpoly_seq.scala +++ b/test/files/pos/tcpoly_seq.scala @@ -16,21 +16,21 @@ trait HOSeq { // is an invariant position -- should probably rule that out? trait Iterable[+m[+x], +t] { //def unit[a](orig: a): m[a] - def elements: Iterator[t] + def iterator: Iterator[t] // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t def accumulator[t]: Accumulator[m, t] def filter(p: t => Boolean): m[t] = { val buf = accumulator[t] - val elems = elements + val elems = iterator while (elems.hasNext) { val x = elems.next; if (p(x)) buf += x } buf.result } def map[s](f: t => s): m[s] = { val buf = accumulator[s] - val elems = elements + val elems = iterator while (elems.hasNext) buf += f(elems.next) buf.result } @@ -42,9 +42,9 @@ trait HOSeq { def flatMap[resColl[+x] <: Iterable[resColl, x], s](f: t => resColl[s])(implicit buf: Accumulator[resColl, s]): resColl[s] = { // TODO: would a viewbound for resColl[x] be better? // -- 2nd-order type params are not yet in scope in view bound - val elems = elements + val elems = iterator while (elems.hasNext) { - val elemss: Iterator[s] = f(elems.next).elements + val elemss: Iterator[s] = f(elems.next).iterator while (elemss.hasNext) buf += elemss.next } buf.result @@ -108,7 +108,7 @@ trait HOSeq { def head: t def tail: List[t] def isEmpty: Boolean - def elements: Iterator[t] = new Iterator[t] { + def iterator: Iterator[t] = new Iterator[t] { var these = List.this def hasNext: Boolean = !these.isEmpty def next: t = diff --git a/test/files/pos/tcpoly_seq_typealias.scala b/test/files/pos/tcpoly_seq_typealias.scala index 7a9312a60a..fb48126ce6 100644 --- a/test/files/pos/tcpoly_seq_typealias.scala +++ b/test/files/pos/tcpoly_seq_typealias.scala @@ -18,21 +18,21 @@ trait HOSeq { type m[+x] //def unit[a](orig: a): m[a] - def elements: Iterator[t] + def iterator: Iterator[t] // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t def accumulator[t]: Accumulator[m, t] def filter(p: t => Boolean): m[t] = { val buf = accumulator[t] - val elems = elements + val elems = iterator while (elems.hasNext) { val x = elems.next; if (p(x)) buf += x } buf.result } def map[s](f: t => s): m[s] = { val buf = accumulator[s] - val elems = elements + val elems = iterator while (elems.hasNext) buf += f(elems.next) buf.result } @@ -44,9 +44,9 @@ trait HOSeq { def flatMap[resColl[+x] <: Iterable[x], s](f: t => resColl[s])(implicit buf: Accumulator[resColl, s]): resColl[s] = { // TODO: would a viewbound for resColl[x] be better? // -- 2nd-order type params are not yet in scope in view bound - val elems = elements + val elems = iterator while (elems.hasNext) { - val elemss: Iterator[s] = f(elems.next).elements + val elemss: Iterator[s] = f(elems.next).iterator while (elemss.hasNext) buf += elemss.next } buf.result @@ -112,7 +112,7 @@ trait HOSeq { def head: t def tail: List[t] def isEmpty: Boolean - def elements: Iterator[t] = new Iterator[t] { + def iterator: Iterator[t] = new Iterator[t] { var these = List.this def hasNext: Boolean = !these.isEmpty def next: t = -- cgit v1.2.3