summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-07 15:44:04 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-08 15:32:46 +0200
commitbc5f42f51982eb473075bbd2f474a5d628813031 (patch)
treea57578c5a21ced5ed38c1a098646fa95ea88f5c2 /test/files/run
parent07f7baa21c165d6c2302a8ea26c475968e7d775e (diff)
downloadscala-bc5f42f51982eb473075bbd2f474a5d628813031.tar.gz
scala-bc5f42f51982eb473075bbd2f474a5d628813031.tar.bz2
scala-bc5f42f51982eb473075bbd2f474a5d628813031.zip
removes array tags
Before 2.10 we had a notion of ClassManifest that could be used to retain erasures of abstract types (type parameters, abstract type members) for being used at runtime. With the advent of ClassManifest (and its subtype Manifest) it became possible to write: def mkGenericArray[T: Manifest] = Array[T]() When compiling array instantiation, scalac would use a ClassManifest implicit parameter from scope (in this case, provided by a context bound) to remember Ts that have been passed to invoke mkGenericArray and use that information to instantiate arrays at runtime (via Java reflection). When redesigning manifests into what is now known as type tags, we decided to explore a notion of ArrayTags that would stand for abstract and pure array creators. Sure, ClassManifests were perfectly fine for this job, but they did too much - technically speaking, one doesn't necessarily need a java.lang.Class to create an array. Depending on a platform, e.g. within JavaScript runtime, one would want to use a different mechanism. As tempting as this idea was, it has also proven to be problematic. First, it created an extra abstraction inside the compiler. Along with class tags and type tags, we had a third flavor of tags - array tags. This has threaded the additional complexity though implicits and typers. Second, consequently, when redesigning tags multiple times over the course of Scala 2.10.0 development, we had to carry this extra abstraction with us, which exacerbated the overall feeling towards array tags. Finally, array tags didn't fit into the naming scheme we had for tags. Both class tags and type tags sound logical, because, they are descriptors for the things they are supposed to tag, according to their names. However array tags are the odd ones, because they don't actually tag any arrays. As funny as it might sound, the naming problem was the last straw that made us do away with the array tags. Hence this commit.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/arrayclone-new.scala4
-rw-r--r--test/files/run/arraytags_basic.check36
-rw-r--r--test/files/run/arraytags_basic.scala24
-rw-r--r--test/files/run/arraytags_core.check48
-rw-r--r--test/files/run/arraytags_core.scala52
-rw-r--r--test/files/run/arraytags_usage.check3
-rw-r--r--test/files/run/arraytags_usage.scala17
-rw-r--r--test/files/run/interop_classtags_are_classmanifests.check3
-rw-r--r--test/files/run/interop_classtags_are_classmanifests.scala9
-rw-r--r--test/files/run/interop_manifests_are_classtags.scala6
-rw-r--r--test/files/run/primitive-sigs-2-new.check2
-rw-r--r--test/files/run/primitive-sigs-2-new.scala4
-rw-r--r--test/files/run/reify_implicits-new.scala4
-rw-r--r--test/files/run/t0421-new.scala4
-rw-r--r--test/files/run/t0677-new.scala4
-rw-r--r--test/files/run/t4216.check8
-rw-r--r--test/files/run/t4216.scala4
17 files changed, 20 insertions, 212 deletions
diff --git a/test/files/run/arrayclone-new.scala b/test/files/run/arrayclone-new.scala
index a8fb9ee58c..506e4f527c 100644
--- a/test/files/run/arrayclone-new.scala
+++ b/test/files/run/arrayclone-new.scala
@@ -1,4 +1,4 @@
-import scala.reflect.{ArrayTag, arrayTag}
+import scala.reflect.{ClassTag, classTag}
object Test extends App{
BooleanArrayClone;
@@ -95,7 +95,7 @@ object PolymorphicArrayClone{
testIt(Array("one", "two"), "one", "two");
- class Mangler[T: ArrayTag](ts : T*){
+ class Mangler[T: ClassTag](ts : T*){
// this will always be a BoxedAnyArray even after we've unboxed its contents.
val it = ts.toArray[T];
}
diff --git a/test/files/run/arraytags_basic.check b/test/files/run/arraytags_basic.check
deleted file mode 100644
index 92816b91bd..0000000000
--- a/test/files/run/arraytags_basic.check
+++ /dev/null
@@ -1,36 +0,0 @@
-class [I
-class [[I
-class [[[I
-class [Lscala.collection.immutable.List;
-class [[Lscala.collection.immutable.List;
-class [[[Lscala.collection.immutable.List;
-class [Lscala.collection.immutable.List;
-class [[Lscala.collection.immutable.List;
-class [[[Lscala.collection.immutable.List;
-class [Lscala.collection.immutable.Map;
-class [[Lscala.collection.immutable.Map;
-class [[[Lscala.collection.immutable.Map;
-class [[I
-class [[[I
-class [[[[I
-class [[Lscala.collection.immutable.List;
-class [[[Lscala.collection.immutable.List;
-class [[[[Lscala.collection.immutable.List;
-class [[Lscala.collection.immutable.List;
-class [[[Lscala.collection.immutable.List;
-class [[[[Lscala.collection.immutable.List;
-class [[Lscala.collection.immutable.Map;
-class [[[Lscala.collection.immutable.Map;
-class [[[[Lscala.collection.immutable.Map;
-class [[[I
-class [[[[I
-class [[[[[I
-class [[[Lscala.collection.immutable.List;
-class [[[[Lscala.collection.immutable.List;
-class [[[[[Lscala.collection.immutable.List;
-class [[[Lscala.collection.immutable.List;
-class [[[[Lscala.collection.immutable.List;
-class [[[[[Lscala.collection.immutable.List;
-class [[[Lscala.collection.immutable.Map;
-class [[[[Lscala.collection.immutable.Map;
-class [[[[[Lscala.collection.immutable.Map;
diff --git a/test/files/run/arraytags_basic.scala b/test/files/run/arraytags_basic.scala
deleted file mode 100644
index 629ee26192..0000000000
--- a/test/files/run/arraytags_basic.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import scala.reflect.{ArrayTag, arrayTag}
-
-object Test extends App {
- def test[T: ArrayTag] = {
- println(implicitly[ArrayTag[T]].newArray(10).getClass)
- println(implicitly[ArrayTag[T]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[T]]].wrap.newArray(10).getClass)
- }
-
- test[Int]
- test[List[Int]]
- test[List[String]]
- test[Map[Int, String]]
-
- test[Array[Int]]
- test[Array[List[Int]]]
- test[Array[List[String]]]
- test[Array[Map[Int, String]]]
-
- test[Array[Array[Int]]]
- test[Array[Array[List[Int]]]]
- test[Array[Array[List[String]]]]
- test[Array[Array[Map[Int, String]]]]
-} \ No newline at end of file
diff --git a/test/files/run/arraytags_core.check b/test/files/run/arraytags_core.check
deleted file mode 100644
index 82ed84ad78..0000000000
--- a/test/files/run/arraytags_core.check
+++ /dev/null
@@ -1,48 +0,0 @@
-class [B
-class [[B
-class [[[B
-class [S
-class [[S
-class [[[S
-class [C
-class [[C
-class [[[C
-class [I
-class [[I
-class [[[I
-class [J
-class [[J
-class [[[J
-class [F
-class [[F
-class [[[F
-class [D
-class [[D
-class [[[D
-class [Z
-class [[Z
-class [[[Z
-class [Lscala.runtime.BoxedUnit;
-class [[Lscala.runtime.BoxedUnit;
-class [[[Lscala.runtime.BoxedUnit;
-class [Ljava.lang.Object;
-class [[Ljava.lang.Object;
-class [[[Ljava.lang.Object;
-class [Ljava.lang.Object;
-class [[Ljava.lang.Object;
-class [[[Ljava.lang.Object;
-class [Ljava.lang.Object;
-class [[Ljava.lang.Object;
-class [[[Ljava.lang.Object;
-class [Ljava.lang.Object;
-class [[Ljava.lang.Object;
-class [[[Ljava.lang.Object;
-class [Lscala.runtime.Null$;
-class [[Lscala.runtime.Null$;
-class [[[Lscala.runtime.Null$;
-class [Lscala.runtime.Nothing$;
-class [[Lscala.runtime.Nothing$;
-class [[[Lscala.runtime.Nothing$;
-class [Ljava.lang.String;
-class [[Ljava.lang.String;
-class [[[Ljava.lang.String;
diff --git a/test/files/run/arraytags_core.scala b/test/files/run/arraytags_core.scala
deleted file mode 100644
index 58b9094230..0000000000
--- a/test/files/run/arraytags_core.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-import scala.reflect.{ArrayTag, arrayTag}
-
-object Test extends App {
- println(implicitly[ArrayTag[Byte]].newArray(10).getClass)
- println(implicitly[ArrayTag[Byte]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Byte]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Short]].newArray(10).getClass)
- println(implicitly[ArrayTag[Short]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Short]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Char]].newArray(10).getClass)
- println(implicitly[ArrayTag[Char]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Char]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Int]].newArray(10).getClass)
- println(implicitly[ArrayTag[Int]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Int]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Long]].newArray(10).getClass)
- println(implicitly[ArrayTag[Long]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Long]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Float]].newArray(10).getClass)
- println(implicitly[ArrayTag[Float]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Float]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Double]].newArray(10).getClass)
- println(implicitly[ArrayTag[Double]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Double]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Boolean]].newArray(10).getClass)
- println(implicitly[ArrayTag[Boolean]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Boolean]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Unit]].newArray(10).getClass)
- println(implicitly[ArrayTag[Unit]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Unit]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Any]].newArray(10).getClass)
- println(implicitly[ArrayTag[Any]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Any]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Object]].newArray(10).getClass)
- println(implicitly[ArrayTag[Object]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Object]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[AnyVal]].newArray(10).getClass)
- println(implicitly[ArrayTag[AnyVal]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[AnyVal]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[AnyRef]].newArray(10).getClass)
- println(implicitly[ArrayTag[AnyRef]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[AnyRef]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Null]].newArray(10).getClass)
- println(implicitly[ArrayTag[Null]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Null]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Nothing]].newArray(10).getClass)
- println(implicitly[ArrayTag[Nothing]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[Nothing]]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[String]].newArray(10).getClass)
- println(implicitly[ArrayTag[String]].wrap.newArray(10).getClass)
- println(implicitly[ArrayTag[Array[String]]].wrap.newArray(10).getClass)
-} \ No newline at end of file
diff --git a/test/files/run/arraytags_usage.check b/test/files/run/arraytags_usage.check
deleted file mode 100644
index b1d02b7bfe..0000000000
--- a/test/files/run/arraytags_usage.check
+++ /dev/null
@@ -1,3 +0,0 @@
-class [I
-class [I
-class [I
diff --git a/test/files/run/arraytags_usage.scala b/test/files/run/arraytags_usage.scala
deleted file mode 100644
index 507e91987b..0000000000
--- a/test/files/run/arraytags_usage.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-import scala.reflect.{ArrayTag, arrayTag}
-
-object Test extends App {
- def foo[T] = {
- class MyArrayTag extends ArrayTag[T] {
- def wrap: ArrayTag[Array[T]] = ???
- def newArray(len: Int): Array[T] = new Array[Int](len).asInstanceOf[Array[T]]
- }
-
- implicit val tag = new MyArrayTag()
- println(Array[T]().getClass)
- }
-
- foo[Int]
- foo[String]
- foo[Array[String]]
-} \ No newline at end of file
diff --git a/test/files/run/interop_classtags_are_classmanifests.check b/test/files/run/interop_classtags_are_classmanifests.check
index 02393dff23..c59e92d4eb 100644
--- a/test/files/run/interop_classtags_are_classmanifests.check
+++ b/test/files/run/interop_classtags_are_classmanifests.check
@@ -1,6 +1,3 @@
Int
java.lang.String
Array[Int]
-Int
-java.lang.String
-Array[Int]
diff --git a/test/files/run/interop_classtags_are_classmanifests.scala b/test/files/run/interop_classtags_are_classmanifests.scala
index 498a947879..91b9d89c6e 100644
--- a/test/files/run/interop_classtags_are_classmanifests.scala
+++ b/test/files/run/interop_classtags_are_classmanifests.scala
@@ -1,15 +1,6 @@
-import scala.reflect.{ArrayTag, arrayTag}
import scala.reflect.{ClassTag, classTag}
object Test extends App {
- def arrayTagIsClassManifest[T: ArrayTag] = {
- println(classManifest[T])
- }
-
- arrayTagIsClassManifest[Int]
- arrayTagIsClassManifest[String]
- arrayTagIsClassManifest[Array[Int]]
-
def classTagIsClassManifest[T: ClassTag] = {
println(classManifest[T])
}
diff --git a/test/files/run/interop_manifests_are_classtags.scala b/test/files/run/interop_manifests_are_classtags.scala
index d2b8bdea5c..03479e527a 100644
--- a/test/files/run/interop_manifests_are_classtags.scala
+++ b/test/files/run/interop_manifests_are_classtags.scala
@@ -1,8 +1,8 @@
-import scala.reflect.{ArrayTag, ClassTag, arrayTag, classTag}
+import scala.reflect.{ClassTag, classTag}
object Test extends App {
def classManifestIsClassTag[T: ClassManifest] = {
- println(arrayTag[T])
+ println(classTag[T])
println(Array[T]().toList)
println(new Array[T](5).toList)
}
@@ -12,7 +12,7 @@ object Test extends App {
classManifestIsClassTag[Array[Int]]
def manifestIsClassTag[T: Manifest] = {
- println(arrayTag[T])
+ println(classTag[T])
println(Array[T]().toList)
println(new Array[T](5).toList)
}
diff --git a/test/files/run/primitive-sigs-2-new.check b/test/files/run/primitive-sigs-2-new.check
index b82ddbeaff..6f79d73d38 100644
--- a/test/files/run/primitive-sigs-2-new.check
+++ b/test/files/run/primitive-sigs-2-new.check
@@ -1,7 +1,7 @@
T<java.lang.Object>
List(A, char, class java.lang.Object)
a
-public <T> java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.ArrayTag<T>)
+public <T> java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.ClassTag<T>)
public float[] Arr.arr3(float[][])
public scala.collection.immutable.List<java.lang.Character> Arr.arr2(java.lang.Character[])
public scala.collection.immutable.List<java.lang.Object> Arr.arr1(int[])
diff --git a/test/files/run/primitive-sigs-2-new.scala b/test/files/run/primitive-sigs-2-new.scala
index ef87a11a61..cf6de9c81b 100644
--- a/test/files/run/primitive-sigs-2-new.scala
+++ b/test/files/run/primitive-sigs-2-new.scala
@@ -1,4 +1,4 @@
-import scala.reflect.{ArrayTag, arrayTag}
+import scala.reflect.{ClassTag, classTag}
import java.{ lang => jl }
trait T[A] {
@@ -11,7 +11,7 @@ class Arr {
def arr1(xs: Array[Int]): List[Int] = xs.toList
def arr2(xs: Array[jl.Character]): List[jl.Character] = xs.toList
def arr3(xss: Array[Array[Float]]): Array[Float] = xss map (_.sum)
- def arr4[T: ArrayTag](xss: Array[Array[T]]): Array[T] = xss map (_.head)
+ def arr4[T: ClassTag](xss: Array[Array[T]]): Array[T] = xss map (_.head)
}
object Test {
diff --git a/test/files/run/reify_implicits-new.scala b/test/files/run/reify_implicits-new.scala
index d203fe2001..42a1deef26 100644
--- a/test/files/run/reify_implicits-new.scala
+++ b/test/files/run/reify_implicits-new.scala
@@ -1,10 +1,10 @@
-import scala.reflect.{ArrayTag, arrayTag}
+import scala.reflect.{ClassTag, classTag}
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
object Test extends App {
reify {
- implicit def arrayWrapper[A : ArrayTag](x: Array[A]) =
+ implicit def arrayWrapper[A : ClassTag](x: Array[A]) =
new {
def sort(p: (A, A) => Boolean) = {
util.Sorting.stableSort(x, p); x
diff --git a/test/files/run/t0421-new.scala b/test/files/run/t0421-new.scala
index 63c4ab5c73..8df5aa1992 100644
--- a/test/files/run/t0421-new.scala
+++ b/test/files/run/t0421-new.scala
@@ -1,9 +1,9 @@
-import scala.reflect.{ArrayTag, arrayTag}
+import scala.reflect.{ClassTag, classTag}
// ticket #421
object Test extends App {
- def transpose[A: ArrayTag](xss: Array[Array[A]]) = {
+ def transpose[A: ClassTag](xss: Array[Array[A]]) = {
for (i <- Array.range(0, xss(0).length)) yield
for (xs <- xss) yield xs(i)
}
diff --git a/test/files/run/t0677-new.scala b/test/files/run/t0677-new.scala
index 85332401b7..15c8b4aa19 100644
--- a/test/files/run/t0677-new.scala
+++ b/test/files/run/t0677-new.scala
@@ -1,7 +1,7 @@
-import scala.reflect.{ArrayTag, arrayTag}
+import scala.reflect.{ClassTag, classTag}
object Test extends App {
- class X[T: ArrayTag] {
+ class X[T: ClassTag] {
val a = Array.ofDim[T](3, 4)
}
val x = new X[String]
diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check
index 0ba987f634..6f2684f42d 100644
--- a/test/files/run/t4216.check
+++ b/test/files/run/t4216.check
@@ -1,11 +1,11 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala> import scala.reflect.ArrayTag
-import scala.reflect.ArrayTag
+scala> import scala.reflect.ClassTag
+import scala.reflect.ClassTag
-scala> def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*)
-f: [A](a: A)(implicit evidence$1: scala.reflect.ArrayTag[A])java.util.List[A]
+scala> def f[A: ClassTag](a: A) = java.util.Arrays.asList(Array(a): _*)
+f: [A](a: A)(implicit evidence$1: scala.reflect.ClassTag[A])java.util.List[A]
scala> f(".")
res0: java.util.List[String] = [.]
diff --git a/test/files/run/t4216.scala b/test/files/run/t4216.scala
index d9395cf538..ecaae5bea2 100644
--- a/test/files/run/t4216.scala
+++ b/test/files/run/t4216.scala
@@ -4,8 +4,8 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code =
"""
- |import scala.reflect.ArrayTag
- |def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*)
+ |import scala.reflect.ClassTag
+ |def f[A: ClassTag](a: A) = java.util.Arrays.asList(Array(a): _*)
|f(".")
|f(0)
|def i(a: Int) = java.util.Arrays.asList(Array(a): _*)