From a91a8b2ac22d49b1690482fbf1271d203ebb457b Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 20 Jul 2009 22:35:38 +0000 Subject: The creation of scala.collection.mutable.Iterab... The creation of scala.collection.mutable.Iterable in 2.8 means that all the other classes in scala.collection.mutable are impacted - what they once thought was scala.Iterable is now mutable Iterable. This meant such things as Stack ++= List(1,2,3) would no longer compile. This patch qualifies the relevant Iterables as collection.Iterables, though based on inspecting other classes, it's likely they should actually be Traversables. --- src/library/scala/collection/mutable/ArrayStack.scala | 2 +- src/library/scala/collection/mutable/BufferProxy.scala | 12 ++++++------ .../scala/collection/mutable/PriorityQueueProxy.scala | 2 +- src/library/scala/collection/mutable/QueueProxy.scala | 2 +- src/library/scala/collection/mutable/Stack.scala | 2 +- src/library/scala/collection/mutable/StackProxy.scala | 2 +- .../scala/collection/mutable/SynchronizedPriorityQueue.scala | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/library/scala/collection/mutable/ArrayStack.scala b/src/library/scala/collection/mutable/ArrayStack.scala index bc3e8eea0d..3292c148b7 100644 --- a/src/library/scala/collection/mutable/ArrayStack.scala +++ b/src/library/scala/collection/mutable/ArrayStack.scala @@ -93,7 +93,7 @@ class ArrayStack[T] private(private var table : Array[AnyRef], * * @param x The source of elements to push */ - def ++=(x : Iterable[T]): this.type = { x.foreach(this +=(_)); this } + def ++=(x : collection.Iterable[T]): this.type = { x.foreach(this +=(_)); this } /** diff --git a/src/library/scala/collection/mutable/BufferProxy.scala b/src/library/scala/collection/mutable/BufferProxy.scala index b45e151da9..ad8ac0970f 100644 --- a/src/library/scala/collection/mutable/BufferProxy.scala +++ b/src/library/scala/collection/mutable/BufferProxy.scala @@ -54,14 +54,14 @@ trait BufferProxy[A] extends Buffer[A] with Proxy { * @param iter the iterable object. * @return the updated buffer. */ - override def ++(iter: Iterable[A]): Buffer[A] = self.++(iter) + override def ++(iter: collection.Iterable[A]): Buffer[A] = self.++(iter) /** Appends a number of elements provided by an iterable object * via its iterator method. * * @param iter the iterable object. */ - override def ++=(iter: Iterable[A]): this.type = { self.++=(iter); this } + override def ++=(iter: collection.Iterable[A]): this.type = { self.++=(iter); this } /** Appends a sequence of elements to this buffer. * @@ -74,7 +74,7 @@ trait BufferProxy[A] extends Buffer[A] with Proxy { * * @param iter the iterable object. */ - override def appendAll(iter: Iterable[A]): Unit = self.appendAll(iter) + override def appendAll(iter: collection.Iterable[A]): Unit = self.appendAll(iter) /** Prepend a single element to this buffer and return * the identity of the buffer. @@ -89,7 +89,7 @@ trait BufferProxy[A] extends Buffer[A] with Proxy { * * @param iter the iterable object. */ - override def ++:(iter: Iterable[A]): Buffer[A] = self.++:(iter) + override def ++:(iter: collection.Iterable[A]): Buffer[A] = self.++:(iter) /** Prepend an element to this list. * @@ -103,7 +103,7 @@ trait BufferProxy[A] extends Buffer[A] with Proxy { * * @param iter the iterable object. */ - override def prependAll(elems: Iterable[A]): Unit = self.prependAll(elems) + override def prependAll(elems: collection.Iterable[A]): Unit = self.prependAll(elems) /** Inserts new elements at the index n. Opposed to method * update, this method will not replace an element with a @@ -121,7 +121,7 @@ trait BufferProxy[A] extends Buffer[A] with Proxy { * @param n the index where a new element will be inserted. * @param iter the iterable object providing all elements to insert. */ - def insertAll(n: Int, iter: Iterable[A]): Unit = self.insertAll(n, iter) + def insertAll(n: Int, iter: collection.Iterable[A]): Unit = self.insertAll(n, iter) /** Replace element at index n with the new element * newelem. diff --git a/src/library/scala/collection/mutable/PriorityQueueProxy.scala b/src/library/scala/collection/mutable/PriorityQueueProxy.scala index de909fa470..1ac00081a8 100644 --- a/src/library/scala/collection/mutable/PriorityQueueProxy.scala +++ b/src/library/scala/collection/mutable/PriorityQueueProxy.scala @@ -54,7 +54,7 @@ abstract class PriorityQueueProxy[A <% Ordered[A]] extends PriorityQueue[A] * * @param iter an iterable object */ - override def ++=(iter: Iterable[A]): Unit = self ++= iter + override def ++=(iter: collection.Iterable[A]): Unit = self ++= iter /** Adds all elements provided by an iterator into the priority queue. * diff --git a/src/library/scala/collection/mutable/QueueProxy.scala b/src/library/scala/collection/mutable/QueueProxy.scala index cd3ca80c5e..cdd37c2ba2 100644 --- a/src/library/scala/collection/mutable/QueueProxy.scala +++ b/src/library/scala/collection/mutable/QueueProxy.scala @@ -51,7 +51,7 @@ trait QueueProxy[A] extends Queue[A] with SeqProxy[A] { * * @param iter an iterable object */ - override def ++=(iter: Iterable[A]): Unit = self ++= iter + override def ++=(iter: collection.Iterable[A]): Unit = self ++= iter /** Adds all elements provided by an iterator * at the end of the queue. The elements are prepended in the order they diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala index 9735eeb215..637a414c5a 100644 --- a/src/library/scala/collection/mutable/Stack.scala +++ b/src/library/scala/collection/mutable/Stack.scala @@ -72,7 +72,7 @@ class Stack[A] private (var elems: List[A]) extends collection.Sequence[A] with def pushAll(elems: collection.Traversable[A]): this.type = { for (elem <- elems) { push(elem); () }; this } @deprecated("use pushAll") def ++=(it: Iterator[A]): this.type = pushAll(it) - @deprecated("use pushAll") def ++=(it: Iterable[A]): this.type = pushAll(it) + @deprecated("use pushAll") def ++=(it: collection.Iterable[A]): this.type = pushAll(it) /** Returns the top element of the stack. This method will not remove * the element from the stack. An error is signaled if there is no diff --git a/src/library/scala/collection/mutable/StackProxy.scala b/src/library/scala/collection/mutable/StackProxy.scala index cb7f180849..a421abce70 100644 --- a/src/library/scala/collection/mutable/StackProxy.scala +++ b/src/library/scala/collection/mutable/StackProxy.scala @@ -51,7 +51,7 @@ trait StackProxy[A] extends Stack[A] with SeqProxy[A] { * * @param iter an iterable object */ - override def ++=(iter: Iterable[A]): Unit = self ++= iter + override def ++=(iter: collection.Iterable[A]): Unit = self ++= iter /** Pushes all elements provided by an iterator * on top of the stack. The elements are pushed in the order they diff --git a/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala b/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala index 65cb592f0b..e82e65a3d2 100644 --- a/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala +++ b/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala @@ -39,7 +39,7 @@ class SynchronizedPriorityQueue[A <% Ordered[A]] extends PriorityQueue[A] { * * @param iter an iterable object */ - override def ++=(iter: Iterable[A]): Unit = synchronized { super.++=(iter) } + override def ++=(iter: collection.Iterable[A]): Unit = synchronized { super.++=(iter) } /** Adds all elements provided by an iterator into the priority queue. * -- cgit v1.2.3