summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-10-08 18:31:44 +0000
committerMartin Odersky <odersky@gmail.com>2009-10-08 18:31:44 +0000
commit9cf9ab263b60ed2ae8ff5c7710a7f59695fc92e7 (patch)
treea35cfe628c41ba4da25d7a1d9077b4298ecf3e67 /src/library
parentadb677e4bc0c2fc7e822615c08384875e06a64ee (diff)
downloadscala-9cf9ab263b60ed2ae8ff5c7710a7f59695fc92e7.tar.gz
scala-9cf9ab263b60ed2ae8ff5c7710a7f59695fc92e7.tar.bz2
scala-9cf9ab263b60ed2ae8ff5c7710a7f59695fc92e7.zip
Definite fix for #2060; fix for #2392.
Added aliases for Vector and Traversable to scala package object.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/Range.scala12
-rw-r--r--src/library/scala/collection/Vector.scala2
-rw-r--r--src/library/scala/package.scala23
3 files changed, 23 insertions, 14 deletions
diff --git a/src/library/scala/Range.scala b/src/library/scala/Range.scala
index 5a27fa21de..c808a3db10 100644
--- a/src/library/scala/Range.scala
+++ b/src/library/scala/Range.scala
@@ -11,7 +11,7 @@
package scala
import annotation.experimental
-import collection.immutable.Vector
+
import collection.VectorView
import util.control.Exception.catching
import util.Hashable
@@ -39,7 +39,7 @@ import util.Hashable
abstract class GenericRange[T]
(val start: T, val end: T, val step: T, val isInclusive: Boolean = false)
(implicit num: Integral[T])
-extends VectorView[T, Vector[T]] with RangeToString[T] with Hashable {
+extends VectorView[T, collection.immutable.Vector[T]] with RangeToString[T] with Hashable {
import num._
// todo? - we could lift the length restriction by implementing a range as a sequence of
@@ -50,7 +50,7 @@ extends VectorView[T, Vector[T]] with RangeToString[T] with Hashable {
// By adjusting end based on isInclusive, we can treat all ranges as exclusive.
private lazy val trueEnd: T = if (isInclusive) end + step else end
- protected def underlying = Vector.empty[T]
+ protected def underlying = collection.immutable.Vector.empty[T]
/** Create a new range with the start and end values of this range and
* a new <code>step</code>.
@@ -129,7 +129,7 @@ extends VectorView[T, Vector[T]] with RangeToString[T] with Hashable {
}
}
-private[scala] trait RangeToString[T] extends VectorView[T, Vector[T]] {
+private[scala] trait RangeToString[T] extends VectorView[T, collection.immutable.Vector[T]] {
// The default toString() tries to print every element and will exhaust memory
// if the Range is unduly large. This interacts poorly with the REPL.
override def toString() = {
@@ -179,11 +179,11 @@ object GenericRange
* @since 2.5
*/
class Range(val start: Int, val end: Int, val step: Int)
-extends VectorView[Int, Vector[Int]] with RangeToString[Int]
+extends VectorView[Int, collection.immutable.Vector[Int]] with RangeToString[Int]
{
require(step != 0)
- protected def underlying = Vector.empty[Int]
+ protected def underlying = collection.immutable.Vector.empty[Int]
/** Create a new range with the start and end values of this range and
* a new <code>step</code>.
diff --git a/src/library/scala/collection/Vector.scala b/src/library/scala/collection/Vector.scala
index cf802ca095..78228b6650 100644
--- a/src/library/scala/collection/Vector.scala
+++ b/src/library/scala/collection/Vector.scala
@@ -36,4 +36,6 @@ trait Vector[+A] extends Seq[A]
object Vector extends SeqFactory[Vector] {
implicit def builderFactory[A]: BuilderFactory[A, Vector[A], Coll] = new VirtualBuilderFactory[A]
def newBuilder[A]: Builder[A, Vector[A]] = mutable.Vector.newBuilder[A]
+
+ @deprecated("use collection.mutable.Vector instead") type Mutable[A] = scala.collection.mutable.Vector[A]
}
diff --git a/src/library/scala/package.scala b/src/library/scala/package.scala
index 39f9dc3dcc..e5572ede30 100644
--- a/src/library/scala/package.scala
+++ b/src/library/scala/package.scala
@@ -10,20 +10,18 @@
package object scala {
+
+ type Travarsable[+A] = scala.collection.Traversable[A]
+ val Traversable = scala.collection.Traversable
+
type Iterable[+A] = scala.collection.Iterable[A]
val Iterable = scala.collection.Iterable
- @deprecated("use Iterable instead") type Collection[+A] = Iterable[A]
- @deprecated("use Iterable instead") val Collection = Iterable
-
type Seq[+A] = scala.collection.Seq[A]
val Seq = scala.collection.Seq
- @deprecated("use Seq instead") type Sequence[+A] = scala.collection.Seq[A]
- @deprecated("use Seq instead") val Sequence = scala.collection.Seq
-
- type RandomAccessSeq[+A] = scala.collection.Vector[A]
- val RandomAccessSeq = scala.collection.Vector
+ type Vector[+A] = scala.collection.Vector[A]
+ val Vector = scala.collection.Vector
type Iterator[+A] = scala.collection.Iterator[A]
val Iterator = scala.collection.Iterator
@@ -43,4 +41,13 @@ package object scala {
type StringBuilder = scala.collection.mutable.StringBuilder
val StringBuilder = scala.collection.mutable.StringBuilder
+
+ @deprecated("use Iterable instead") type Collection[+A] = Iterable[A]
+ @deprecated("use Iterable instead") val Collection = Iterable
+
+ @deprecated("use Seq instead") type Sequence[+A] = scala.collection.Seq[A]
+ @deprecated("use Seq instead") val Sequence = scala.collection.Seq
+
+ @deprecated("use Vector instead") type RandomAccessSeq[+A] = scala.collection.Vector[A]
+ @deprecated("use Vector instead") val RandomAccessSeq = scala.collection.Vector
}