From bc5f42f51982eb473075bbd2f474a5d628813031 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Thu, 7 Jun 2012 15:44:04 +0200 Subject: 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. --- test/files/jvm/serialization-new.scala | 8 +-- test/files/neg/classtags_contextbound_a.check | 2 +- test/files/neg/classtags_contextbound_c.check | 2 +- test/files/neg/classtags_dont_use_typetags.check | 2 +- .../neg/interop_classtags_arenot_manifests.check | 7 +-- .../neg/interop_classtags_arenot_manifests.scala | 9 --- test/files/neg/t2775.check | 8 +-- test/files/pos/implicits-new.scala | 4 +- test/files/pos/spec-constr-new.scala | 4 +- test/files/pos/spec-fields-new.scala | 4 +- test/files/pos/spec-params-new.scala | 4 +- test/files/pos/spec-sparsearray-new.scala | 4 +- test/files/pos/t2795-new.scala | 4 +- test/files/pos/t3498-new.scala | 4 +- test/files/pos/t5769.scala | 6 +- test/files/presentation/ide-bug-1000531.check | 2 +- test/files/run/arrayclone-new.scala | 4 +- test/files/run/arraytags_basic.check | 36 ----------- test/files/run/arraytags_basic.scala | 24 -------- test/files/run/arraytags_core.check | 48 --------------- test/files/run/arraytags_core.scala | 52 ---------------- test/files/run/arraytags_usage.check | 3 - test/files/run/arraytags_usage.scala | 17 ------ .../run/interop_classtags_are_classmanifests.check | 3 - .../run/interop_classtags_are_classmanifests.scala | 9 --- .../run/interop_manifests_are_classtags.scala | 6 +- test/files/run/primitive-sigs-2-new.check | 2 +- test/files/run/primitive-sigs-2-new.scala | 4 +- test/files/run/reify_implicits-new.scala | 4 +- test/files/run/t0421-new.scala | 4 +- test/files/run/t0677-new.scala | 4 +- test/files/run/t4216.check | 8 +-- test/files/run/t4216.scala | 4 +- test/files/scalacheck/array-new.scala | 4 +- test/files/specialized/spec-matrix-new.scala | 6 +- test/files/speclib/instrumented.jar.desired.sha1 | 2 +- .../library/scala/runtime/ScalaRunTime.scala | 3 +- test/instrumented/srt.patch | 69 +++++++++++++++++----- 38 files changed, 112 insertions(+), 278 deletions(-) delete mode 100644 test/files/run/arraytags_basic.check delete mode 100644 test/files/run/arraytags_basic.scala delete mode 100644 test/files/run/arraytags_core.check delete mode 100644 test/files/run/arraytags_core.scala delete mode 100644 test/files/run/arraytags_usage.check delete mode 100644 test/files/run/arraytags_usage.scala (limited to 'test') diff --git a/test/files/jvm/serialization-new.scala b/test/files/jvm/serialization-new.scala index d9c23dc0e1..91eb52928f 100644 --- a/test/files/jvm/serialization-new.scala +++ b/test/files/jvm/serialization-new.scala @@ -1,5 +1,3 @@ -import scala.reflect.{ArrayTag, arrayTag} - //############################################################################ // Serialization //############################################################################ @@ -284,7 +282,7 @@ object Test2_immutable { // Test classes in package "scala.collection.mutable" object Test3_mutable { - import scala.reflect.ArrayTag + import scala.reflect.ClassTag import scala.collection.mutable.{ ArrayBuffer, ArrayBuilder, ArraySeq, ArrayStack, BitSet, DoubleLinkedList, HashMap, HashSet, History, LinkedList, ListBuffer, Publisher, Queue, @@ -301,11 +299,11 @@ object Test3_mutable { // ArrayBuilder val abu1 = ArrayBuilder.make[Long] - val _abu1: ArrayBuilder[ArrayTag[Long]] = read(write(abu1)) + val _abu1: ArrayBuilder[ClassTag[Long]] = read(write(abu1)) check(abu1, _abu1) val abu2 = ArrayBuilder.make[Float] - val _abu2: ArrayBuilder[ArrayTag[Float]] = read(write(abu2)) + val _abu2: ArrayBuilder[ClassTag[Float]] = read(write(abu2)) check(abu2, _abu2) // ArraySeq diff --git a/test/files/neg/classtags_contextbound_a.check b/test/files/neg/classtags_contextbound_a.check index a4fd37506d..f4b6ff5af1 100644 --- a/test/files/neg/classtags_contextbound_a.check +++ b/test/files/neg/classtags_contextbound_a.check @@ -1,4 +1,4 @@ -classtags_contextbound_a.scala:2: error: No ArrayTag available for T +classtags_contextbound_a.scala:2: error: No ClassTag available for T def foo[T] = Array[T]() ^ one error found diff --git a/test/files/neg/classtags_contextbound_c.check b/test/files/neg/classtags_contextbound_c.check index 73b451d61c..f8768eea2b 100644 --- a/test/files/neg/classtags_contextbound_c.check +++ b/test/files/neg/classtags_contextbound_c.check @@ -1,4 +1,4 @@ -classtags_contextbound_c.scala:4: error: No ArrayTag available for T +classtags_contextbound_c.scala:4: error: No ClassTag available for T def mkArray[T] = Array[T]() ^ one error found diff --git a/test/files/neg/classtags_dont_use_typetags.check b/test/files/neg/classtags_dont_use_typetags.check index c12b2874dc..24585e7c3f 100644 --- a/test/files/neg/classtags_dont_use_typetags.check +++ b/test/files/neg/classtags_dont_use_typetags.check @@ -1,4 +1,4 @@ -classtags_dont_use_typetags.scala:4: error: No ArrayTag available for T +classtags_dont_use_typetags.scala:4: error: No ClassTag available for T def foo[T: TypeTag] = Array[T]() ^ one error found diff --git a/test/files/neg/interop_classtags_arenot_manifests.check b/test/files/neg/interop_classtags_arenot_manifests.check index 2d1a896872..6982f0b805 100644 --- a/test/files/neg/interop_classtags_arenot_manifests.check +++ b/test/files/neg/interop_classtags_arenot_manifests.check @@ -1,7 +1,4 @@ -interop_classtags_arenot_manifests.scala:6: error: No Manifest available for T. +interop_classtags_arenot_manifests.scala:5: error: No Manifest available for T. println(manifest[T]) ^ -interop_classtags_arenot_manifests.scala:14: error: No Manifest available for T. - println(manifest[T]) - ^ -two errors found +one error found diff --git a/test/files/neg/interop_classtags_arenot_manifests.scala b/test/files/neg/interop_classtags_arenot_manifests.scala index 5c4130ad6d..391143c6e8 100644 --- a/test/files/neg/interop_classtags_arenot_manifests.scala +++ b/test/files/neg/interop_classtags_arenot_manifests.scala @@ -1,15 +1,6 @@ -import scala.reflect.{ArrayTag, arrayTag} import scala.reflect.{ClassTag, classTag} object Test extends App { - def arrayTagIsnotManifest[T: ArrayTag] = { - println(manifest[T]) - } - - arrayTagIsnotManifest[Int] - arrayTagIsnotManifest[String] - arrayTagIsnotManifest[Array[Int]] - def classTagIsnotManifest[T: ClassTag] = { println(manifest[T]) } diff --git a/test/files/neg/t2775.check b/test/files/neg/t2775.check index a1e950cf73..f357221cd9 100644 --- a/test/files/neg/t2775.check +++ b/test/files/neg/t2775.check @@ -1,4 +1,4 @@ -t2775.scala:1: error: cannot find array tag for element type B.this.T -trait B[S] { type T = S; val c = new Array[T](1) } - ^ -one error found +t2775.scala:1: error: cannot find class tag for element type B.this.T +trait B[S] { type T = S; val c = new Array[T](1) } + ^ +one error found diff --git a/test/files/pos/implicits-new.scala b/test/files/pos/implicits-new.scala index 0afbda1c3c..b46ed36082 100644 --- a/test/files/pos/implicits-new.scala +++ b/test/files/pos/implicits-new.scala @@ -1,5 +1,5 @@ import scala.reflect.runtime.universe._ -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} // #1435 object t1435 { @@ -60,7 +60,7 @@ object Test1625 { } object Test2188 { - implicit def toJavaList[A: ArrayTag](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) + implicit def toJavaList[A: ClassTag](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) val x: java.util.List[String] = List("foo") } diff --git a/test/files/pos/spec-constr-new.scala b/test/files/pos/spec-constr-new.scala index a117e99fef..7beff91d8d 100644 --- a/test/files/pos/spec-constr-new.scala +++ b/test/files/pos/spec-constr-new.scala @@ -1,6 +1,6 @@ -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} -class SparseArray2[@specialized(Int) T:ArrayTag](val maxSize: Int, initialLength:Int = 3) { +class SparseArray2[@specialized(Int) T:ClassTag](val maxSize: Int, initialLength:Int = 3) { private var data = new Array[T](initialLength); private var index = new Array[Int](initialLength); diff --git a/test/files/pos/spec-fields-new.scala b/test/files/pos/spec-fields-new.scala index 54bbe27893..de75b4b748 100644 --- a/test/files/pos/spec-fields-new.scala +++ b/test/files/pos/spec-fields-new.scala @@ -1,6 +1,6 @@ -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} -abstract class Foo[@specialized T: ArrayTag, U <: Ordered[U]](x: T, size: Int) { +abstract class Foo[@specialized T: ClassTag, U <: Ordered[U]](x: T, size: Int) { var y: T var z: T = x diff --git a/test/files/pos/spec-params-new.scala b/test/files/pos/spec-params-new.scala index bf89f3920a..661e686f0e 100644 --- a/test/files/pos/spec-params-new.scala +++ b/test/files/pos/spec-params-new.scala @@ -1,6 +1,6 @@ -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} -class Foo[@specialized A: ArrayTag] { +class Foo[@specialized A: ClassTag] { // conflicting in bounds, expect a normalized member calling m // and bridge + implementation in specialized subclasses diff --git a/test/files/pos/spec-sparsearray-new.scala b/test/files/pos/spec-sparsearray-new.scala index 99156d677b..7b3934c476 100644 --- a/test/files/pos/spec-sparsearray-new.scala +++ b/test/files/pos/spec-sparsearray-new.scala @@ -1,7 +1,7 @@ -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} import scala.collection.mutable.MapLike -class SparseArray[@specialized(Int) T:ArrayTag] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] { +class SparseArray[@specialized(Int) T:ClassTag] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] { override def get(x: Int) = { val ind = findOffset(x) if(ind < 0) None else Some(error("ignore")) diff --git a/test/files/pos/t2795-new.scala b/test/files/pos/t2795-new.scala index 67c34ec263..a6a5fdb127 100644 --- a/test/files/pos/t2795-new.scala +++ b/test/files/pos/t2795-new.scala @@ -1,13 +1,13 @@ package t1 -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} trait Element[T] { } trait Config { type T <: Element[T] - implicit val m: ArrayTag[T] + implicit val m: ClassTag[T] // XXX Following works fine: // type T <: Element[_] } diff --git a/test/files/pos/t3498-new.scala b/test/files/pos/t3498-new.scala index 7388e53e3e..eaf00cc351 100644 --- a/test/files/pos/t3498-new.scala +++ b/test/files/pos/t3498-new.scala @@ -1,6 +1,6 @@ -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} -abstract class A[T, @specialized(scala.Int) U : ArrayTag] { +abstract class A[T, @specialized(scala.Int) U : ClassTag] { def f(state: T): Array[U] } diff --git a/test/files/pos/t5769.scala b/test/files/pos/t5769.scala index 523fe08a60..fdc46b65e9 100644 --- a/test/files/pos/t5769.scala +++ b/test/files/pos/t5769.scala @@ -1,9 +1,9 @@ // a.scala -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} class A { type AI = Array[Int] - def f1 = arrayTag[Array[Int]] - def f2 = arrayTag[AI] + def f1 = classTag[Array[Int]] + def f2 = classTag[AI] } \ No newline at end of file diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check index 14ae7ab04a..e813ce119b 100644 --- a/test/files/presentation/ide-bug-1000531.check +++ b/test/files/presentation/ide-bug-1000531.check @@ -97,7 +97,7 @@ retrieved 124 members [accessible: true] `method synchronized[T0](x$1: T0)T0` [accessible: true] `method take(n: Int)Iterator[B]` [accessible: true] `method takeWhile(p: B => Boolean)Iterator[B]` -[accessible: true] `method toArray[B >: B](implicit evidence$1: scala.reflect.ArrayTag[B])Array[B]` +[accessible: true] `method toArray[B >: B](implicit evidence$1: scala.reflect.ClassTag[B])Array[B]` [accessible: true] `method toBuffer[B >: B]=> scala.collection.mutable.Buffer[B]` [accessible: true] `method toIndexedSeq=> scala.collection.immutable.IndexedSeq[B]` [accessible: true] `method toIterable=> Iterable[B]` 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 List(A, char, class java.lang.Object) a -public java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.ArrayTag) +public java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.ClassTag) public float[] Arr.arr3(float[][]) public scala.collection.immutable.List Arr.arr2(java.lang.Character[]) public scala.collection.immutable.List 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): _*) diff --git a/test/files/scalacheck/array-new.scala b/test/files/scalacheck/array-new.scala index 4a9c9d8504..e13a47a5d5 100644 --- a/test/files/scalacheck/array-new.scala +++ b/test/files/scalacheck/array-new.scala @@ -1,4 +1,4 @@ -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} import org.scalacheck._ import Prop._ import Gen._ @@ -10,7 +10,7 @@ import scala.collection.mutable.ArraySeq object Test extends Properties("Array") { /** At this moment the authentic scalacheck Array Builder/Arb bits are commented out. */ - implicit def arbArray[T](implicit a: Arbitrary[T], m: ArrayTag[T]): Arbitrary[Array[T]] = + implicit def arbArray[T](implicit a: Arbitrary[T], m: ClassTag[T]): Arbitrary[Array[T]] = Arbitrary(containerOf[List,T](arbitrary[T]) map (_.toArray)) val arrGen: Gen[Array[_]] = oneOf( diff --git a/test/files/specialized/spec-matrix-new.scala b/test/files/specialized/spec-matrix-new.scala index 1ccff6ed95..e9a6e35219 100644 --- a/test/files/specialized/spec-matrix-new.scala +++ b/test/files/specialized/spec-matrix-new.scala @@ -1,9 +1,9 @@ -import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} /** Test matrix multiplication with specialization. */ -class Matrix[@specialized A: ArrayTag](val rows: Int, val cols: Int) { +class Matrix[@specialized A: ClassTag](val rows: Int, val cols: Int) { private val arr: Array[Array[A]] = Array.ofDim[A](rows, cols) def apply(i: Int, j: Int): A = { @@ -54,7 +54,7 @@ object Test { } } - def multTag[@specialized(Int) T](m: Matrix[T], n: Matrix[T])(implicit at: ArrayTag[T], num: Numeric[T]) { + def multTag[@specialized(Int) T](m: Matrix[T], n: Matrix[T])(implicit at: ClassTag[T], num: Numeric[T]) { val p = new Matrix[T](m.rows, n.cols) import num._ diff --git a/test/files/speclib/instrumented.jar.desired.sha1 b/test/files/speclib/instrumented.jar.desired.sha1 index 4ce7bdc65a..24856fe19a 100644 --- a/test/files/speclib/instrumented.jar.desired.sha1 +++ b/test/files/speclib/instrumented.jar.desired.sha1 @@ -1 +1 @@ -72bdc6e8225f777d98b3990fcd907127eaa8d718 ?instrumented.jar +474d8c20ab31438d5d4a2ba6bc07ebdcdb530b50 ?instrumented.jar diff --git a/test/instrumented/library/scala/runtime/ScalaRunTime.scala b/test/instrumented/library/scala/runtime/ScalaRunTime.scala index f0d452a9be..5a3f83015f 100644 --- a/test/instrumented/library/scala/runtime/ScalaRunTime.scala +++ b/test/instrumented/library/scala/runtime/ScalaRunTime.scala @@ -14,7 +14,7 @@ import scala.collection.{ Seq, IndexedSeq, TraversableView, AbstractIterator } import scala.collection.mutable.WrappedArray import scala.collection.immutable.{ StringLike, NumericRange, List, Stream, Nil, :: } import scala.collection.generic.{ Sorted } -import scala.reflect.{ ArrayTag, ClassTag, arrayTag, classTag } +import scala.reflect.{ ClassTag, classTag } import scala.util.control.ControlThrowable import scala.xml.{ Node, MetaData } @@ -63,7 +63,6 @@ object ScalaRunTime { def arrayElementClass(schematic: Any): Class[_] = schematic match { case cls: Class[_] => cls.getComponentType case tag: ClassTag[_] => tag.runtimeClass - case tag: ArrayTag[_] => tag.newArray(0).getClass.getComponentType case _ => throw new UnsupportedOperationException("unsupported schematic %s (%s)".format(schematic, if (schematic == null) "null" else schematic.getClass)) } diff --git a/test/instrumented/srt.patch b/test/instrumented/srt.patch index 366763e7f9..47dcfa2197 100644 --- a/test/instrumented/srt.patch +++ b/test/instrumented/srt.patch @@ -1,26 +1,67 @@ -9a10,11 +8a9,10 > /* INSTRUMENTED VERSION */ -> -44c46,49 -< def isTuple(x: Any) = x != null && tupleNames(x.getClass.getName) ---- +> +73a76,77 > var arrayApplyCount = 0 -> var arrayUpdateCount = 0 -> -> def isTuple(x: Any) = tupleNames(x.getClass.getName) -76c81,83 +> +75,86c79,93 < def array_apply(xs: AnyRef, idx: Int): Any = xs match { +< case x: Array[AnyRef] => x(idx).asInstanceOf[Any] +< case x: Array[Int] => x(idx).asInstanceOf[Any] +< case x: Array[Double] => x(idx).asInstanceOf[Any] +< case x: Array[Long] => x(idx).asInstanceOf[Any] +< case x: Array[Float] => x(idx).asInstanceOf[Any] +< case x: Array[Char] => x(idx).asInstanceOf[Any] +< case x: Array[Byte] => x(idx).asInstanceOf[Any] +< case x: Array[Short] => x(idx).asInstanceOf[Any] +< case x: Array[Boolean] => x(idx).asInstanceOf[Any] +< case x: Array[Unit] => x(idx).asInstanceOf[Any] +< case null => throw new NullPointerException --- > def array_apply(xs: AnyRef, idx: Int): Any = { > arrayApplyCount += 1 > xs match { -88a96 -> } -91c99,101 +> case x: Array[AnyRef] => x(idx).asInstanceOf[Any] +> case x: Array[Int] => x(idx).asInstanceOf[Any] +> case x: Array[Double] => x(idx).asInstanceOf[Any] +> case x: Array[Long] => x(idx).asInstanceOf[Any] +> case x: Array[Float] => x(idx).asInstanceOf[Any] +> case x: Array[Char] => x(idx).asInstanceOf[Any] +> case x: Array[Byte] => x(idx).asInstanceOf[Any] +> case x: Array[Short] => x(idx).asInstanceOf[Any] +> case x: Array[Boolean] => x(idx).asInstanceOf[Any] +> case x: Array[Unit] => x(idx).asInstanceOf[Any] +> case null => throw new NullPointerException +> } +88a96,97 +> var arrayUpdateCount = 0 +> +90,101c99,113 < def array_update(xs: AnyRef, idx: Int, value: Any): Unit = xs match { +< case x: Array[AnyRef] => x(idx) = value.asInstanceOf[AnyRef] +< case x: Array[Int] => x(idx) = value.asInstanceOf[Int] +< case x: Array[Double] => x(idx) = value.asInstanceOf[Double] +< case x: Array[Long] => x(idx) = value.asInstanceOf[Long] +< case x: Array[Float] => x(idx) = value.asInstanceOf[Float] +< case x: Array[Char] => x(idx) = value.asInstanceOf[Char] +< case x: Array[Byte] => x(idx) = value.asInstanceOf[Byte] +< case x: Array[Short] => x(idx) = value.asInstanceOf[Short] +< case x: Array[Boolean] => x(idx) = value.asInstanceOf[Boolean] +< case x: Array[Unit] => x(idx) = value.asInstanceOf[Unit] +< case null => throw new NullPointerException --- > def array_update(xs: AnyRef, idx: Int, value: Any): Unit = { > arrayUpdateCount += 1 > xs match { -102a113 -> } +> case x: Array[AnyRef] => x(idx) = value.asInstanceOf[AnyRef] +> case x: Array[Int] => x(idx) = value.asInstanceOf[Int] +> case x: Array[Double] => x(idx) = value.asInstanceOf[Double] +> case x: Array[Long] => x(idx) = value.asInstanceOf[Long] +> case x: Array[Float] => x(idx) = value.asInstanceOf[Float] +> case x: Array[Char] => x(idx) = value.asInstanceOf[Char] +> case x: Array[Byte] => x(idx) = value.asInstanceOf[Byte] +> case x: Array[Short] => x(idx) = value.asInstanceOf[Short] +> case x: Array[Boolean] => x(idx) = value.asInstanceOf[Boolean] +> case x: Array[Unit] => x(idx) = value.asInstanceOf[Unit] +> case null => throw new NullPointerException +> } -- cgit v1.2.3