summaryrefslogtreecommitdiff
path: root/test/files/pos/tcpoly_seq.scala
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2009-05-27 19:35:02 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2009-05-27 19:35:02 +0000
commitcc5e79c9ec9cea8d0f22020b528877d8f6e00153 (patch)
tree94e43f77c7b7271b3d0b6f9fb7372ae83b39360d /test/files/pos/tcpoly_seq.scala
parent4b8be5d8bec86358276407d6521c41702ccda835 (diff)
downloadscala-cc5e79c9ec9cea8d0f22020b528877d8f6e00153.tar.gz
scala-cc5e79c9ec9cea8d0f22020b528877d8f6e00153.tar.bz2
scala-cc5e79c9ec9cea8d0f22020b528877d8f6e00153.zip
In "Iterable" and in all its subclasses, "itera...
In "Iterable" and in all its subclasses, "iterator" replaces "elements" (and assorted changes).
Diffstat (limited to 'test/files/pos/tcpoly_seq.scala')
-rw-r--r--test/files/pos/tcpoly_seq.scala12
1 files changed, 6 insertions, 6 deletions
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 =