summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2005-10-17 16:02:14 +0000
committerIulian Dragos <jaguarul@gmail.com>2005-10-17 16:02:14 +0000
commit9cbac19bd6ea417b11c9a63ac3cec4c7055d4ef3 (patch)
treebaf992b93c1cf26f41458e5bed0e2f461e7659b8
parent471bb9d01177e380cb92cb330081f32e6dba1aac (diff)
downloadscala-9cbac19bd6ea417b11c9a63ac3cec4c7055d4ef3.tar.gz
scala-9cbac19bd6ea417b11c9a63ac3cec4c7055d4ef3.tar.bz2
scala-9cbac19bd6ea417b11c9a63ac3cec4c7055d4ef3.zip
Added type test to make List.apply(xs: A*) comp...
Added type test to make List.apply(xs: A*) compatible with both scalac and nsc.
-rw-r--r--sources/scala/List.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/sources/scala/List.scala b/sources/scala/List.scala
index 7bd2c5f45e..f7a33dbd9f 100644
--- a/sources/scala/List.scala
+++ b/sources/scala/List.scala
@@ -24,7 +24,12 @@ object List {
* @param xs the elements to put in the list
* @return the list containing elements xs.
*/
- def apply[A](xs: A*): List[A] = xs.asInstanceOf$erased[List[A]];
+ def apply[A](xs: A*): List[A] =
+ // TODO: remove the type test once nsc becomes standard
+ if (xs.isInstanceOf$erased[List[A]])
+ xs.asInstanceOf$erased[List[A]];
+ else
+ fromArray(xs.asInstanceOf$erased[Array[A]]);
/** Create a sorted list of all integers in a range.
*