diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/benchmarks/src/scala/collection/parallel/benchmarks/arrays/Resetting.scala | 8 | ||||
-rw-r--r-- | test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/MatrixMultiplication.scala | 26 | ||||
-rw-r--r-- | test/disabled/presentation/akka.check | 24 | ||||
-rw-r--r-- | test/disabled/presentation/akka/src/akka/actor/Actor.scala | 4 | ||||
-rw-r--r-- | test/disabled/presentation/akka/src/akka/actor/ActorRef.scala | 16 | ||||
-rw-r--r-- | test/disabled/presentation/akka/src/akka/actor/ActorRegistry.scala | 30 | ||||
-rw-r--r-- | test/disabled/presentation/akka/src/akka/event/EventHandler.scala | 4 | ||||
-rw-r--r-- | test/disabled/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala | 4 | ||||
-rw-r--r-- | test/disabled/presentation/akka/src/akka/util/Helpers.scala | 2 | ||||
-rw-r--r-- | test/disabled/presentation/simple-tests.check | 2 | ||||
-rw-r--r-- | test/files/jvm/manifests-new.check | 58 | ||||
-rw-r--r-- | test/files/jvm/manifests-new.scala (renamed from test/files/jvm/manifests.scala) | 21 | ||||
-rw-r--r-- | test/files/jvm/manifests.check | 56 | ||||
-rw-r--r-- | test/files/jvm/serialization-new.check (renamed from test/files/jvm/serialization.check) | 0 | ||||
-rw-r--r-- | test/files/jvm/serialization-new.scala (renamed from test/files/jvm/serialization.scala) | 40 | ||||
-rw-r--r-- | test/files/neg/t2386.check | 4 | ||||
-rw-r--r-- | test/files/neg/t2386.scala | 3 | ||||
-rw-r--r-- | test/files/neg/t3692-new.check | 4 | ||||
-rw-r--r-- | test/files/neg/t3692-new.flags (renamed from test/files/neg/t3692.flags) | 0 | ||||
-rw-r--r-- | test/files/neg/t3692-new.scala (renamed from test/files/neg/t3692.scala) | 8 | ||||
-rw-r--r-- | test/files/neg/t3692.check | 11 | ||||
-rw-r--r-- | test/files/neg/t5452-new.check | 8 | ||||
-rw-r--r-- | test/files/neg/t5452-new.scala (renamed from test/files/neg/t5452.scala) | 4 | ||||
-rw-r--r-- | test/files/neg/t5452.check | 8 | ||||
-rw-r--r-- | test/files/pos/contextbounds-implicits-new.scala (renamed from test/files/pos/contextbounds-implicits.scala) | 2 | ||||
-rw-r--r-- | test/files/pos/implicits-new.scala (renamed from test/files/pos/implicits.scala) | 36 | ||||
-rw-r--r-- | test/files/pos/manifest1-new.scala (renamed from test/files/pos/manifest1.scala) | 8 | ||||
-rw-r--r-- | test/files/pos/nothing_manifest_disambig-new.scala | 10 | ||||
-rw-r--r-- | test/files/pos/nothing_manifest_disambig.scala | 10 | ||||
-rw-r--r-- | test/files/pos/spec-constr-new.scala (renamed from test/files/pos/spec-constr.scala) | 2 | ||||
-rw-r--r-- | test/files/pos/spec-doubledef-new.scala (renamed from test/files/pos/spec-doubledef.scala) | 2 | ||||
-rw-r--r-- | test/files/pos/spec-fields-new.scala (renamed from test/files/pos/spec-fields.scala) | 2 | ||||
-rw-r--r-- | test/files/pos/spec-params-new.scala (renamed from test/files/pos/spec-params.scala) | 8 | ||||
-rw-r--r-- | test/files/pos/spec-sparsearray-new.scala (renamed from test/files/pos/spec-sparsearray.scala) | 2 | ||||
-rw-r--r-- | test/files/pos/t1381-new.scala (renamed from test/files/pos/t1381.scala) | 2 | ||||
-rw-r--r-- | test/files/pos/t2795-new.scala (renamed from test/files/pos/t2795.scala) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | test/files/pos/t3363-new.scala (renamed from test/files/pos/t3363.scala) | 14 | ||||
-rw-r--r-- | test/files/pos/t3498-new.scala (renamed from test/files/pos/t3498.scala) | 2 | ||||
-rw-r--r-- | test/files/presentation/ide-bug-1000531.check | 2 | ||||
-rw-r--r-- | test/files/run/arrayclone-new.scala (renamed from test/files/run/arrayclone.scala) | 26 | ||||
-rw-r--r-- | test/files/run/ctries-new/DumbHash.scala (renamed from test/files/run/ctries/DumbHash.scala) | 0 | ||||
-rw-r--r-- | test/files/run/ctries-new/Wrap.scala (renamed from test/files/run/ctries/Wrap.scala) | 0 | ||||
-rw-r--r-- | test/files/run/ctries-new/concmap.scala (renamed from test/files/run/ctries/concmap.scala) | 0 | ||||
-rw-r--r-- | test/files/run/ctries-new/iterator.scala (renamed from test/files/run/ctries/iterator.scala) | 0 | ||||
-rw-r--r-- | test/files/run/ctries-new/lnode.scala (renamed from test/files/run/ctries/lnode.scala) | 0 | ||||
-rw-r--r-- | test/files/run/ctries-new/main.scala (renamed from test/files/run/ctries/main.scala) | 18 | ||||
-rw-r--r-- | test/files/run/ctries-new/snapshot.scala (renamed from test/files/run/ctries/snapshot.scala) | 0 | ||||
-rw-r--r-- | test/files/run/existentials3-new.check (renamed from test/files/run/existentials3.check) | 48 | ||||
-rw-r--r-- | test/files/run/existentials3-new.scala (renamed from test/files/run/existentials3.scala) | 3 | ||||
-rw-r--r-- | test/files/run/getClassTest-new.check (renamed from test/files/run/getClassTest.check) | 0 | ||||
-rw-r--r-- | test/files/run/getClassTest-new.scala (renamed from test/files/run/getClassTest.scala) | 12 | ||||
-rw-r--r-- | test/files/run/manifests-new.scala (renamed from test/files/run/manifests.scala) | 46 | ||||
-rw-r--r-- | test/files/run/patmat_unapp_abstype-new.check (renamed from test/files/run/patmat_unapp_abstype.check) | 0 | ||||
-rw-r--r-- | test/files/run/patmat_unapp_abstype-new.flags (renamed from test/files/run/patmat_unapp_abstype.flags) | 0 | ||||
-rw-r--r-- | test/files/run/patmat_unapp_abstype-new.scala (renamed from test/files/run/patmat_unapp_abstype.scala) | 0 | ||||
-rw-r--r-- | test/files/run/primitive-sigs-2-new.check (renamed from test/files/run/primitive-sigs-2.check) | 2 | ||||
-rw-r--r-- | test/files/run/primitive-sigs-2-new.scala (renamed from test/files/run/primitive-sigs-2.scala) | 12 | ||||
-rw-r--r-- | test/files/run/reflection-implClass-new.scala (renamed from test/files/run/reflection-implClass.scala) | 12 | ||||
-rw-r--r-- | test/files/run/reify_implicits-new.check (renamed from test/files/run/reify_implicits.check) | 0 | ||||
-rw-r--r-- | test/files/run/reify_implicits-new.scala (renamed from test/files/run/reify_implicits.scala) | 2 | ||||
-rw-r--r-- | test/files/run/repl-power.check | 64 | ||||
-rw-r--r-- | test/files/run/repl-power.scala | 3 | ||||
-rw-r--r-- | test/files/run/t0421-new.check (renamed from test/files/run/t0421.check) | 0 | ||||
-rw-r--r-- | test/files/run/t0421-new.scala (renamed from test/files/run/t0421.scala) | 12 | ||||
-rw-r--r-- | test/files/run/t0677-new.scala (renamed from test/files/run/t0677.scala) | 2 | ||||
-rw-r--r-- | test/files/run/t1195-new.check (renamed from test/files/run/t1195.check) | 0 | ||||
-rw-r--r-- | test/files/run/t1195-new.scala (renamed from test/files/run/t1195.scala) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | test/files/run/t2236-new.scala (renamed from test/files/run/t2236.scala) | 2 | ||||
-rw-r--r-- | test/files/run/t2386-new.check | 2 | ||||
-rw-r--r-- | test/files/run/t2386-new.scala | 5 | ||||
-rw-r--r-- | test/files/run/t3507-new.check (renamed from test/files/run/t3507.check) | 0 | ||||
-rw-r--r-- | test/files/run/t3507-new.scala (renamed from test/files/run/t3507.scala) | 2 | ||||
-rw-r--r-- | test/files/run/t3758.check | 6 | ||||
-rw-r--r-- | test/files/run/t3758.scala | 10 | ||||
-rw-r--r-- | test/files/run/t4110-new.check (renamed from test/files/run/t4110.check) | 0 | ||||
-rw-r--r-- | test/files/run/t4110-new.scala (renamed from test/files/run/t4110.scala) | 4 | ||||
-rw-r--r-- | test/files/scalacheck/array-new.scala (renamed from test/files/scalacheck/array.scala) | 9 | ||||
-rw-r--r-- | test/files/specialized/spec-matrix-new.check (renamed from test/files/specialized/spec-matrix.check) | 0 | ||||
-rw-r--r-- | test/files/specialized/spec-matrix-new.scala (renamed from test/files/specialized/spec-matrix.scala) | 16 | ||||
-rw-r--r-- | test/pending/pos/inference.scala | 20 | ||||
-rw-r--r-- | test/pending/shootout/meteor.scala | 64 | ||||
-rw-r--r-- | test/scaladoc/resources/implicits-base-res.scala | 3 |
82 files changed, 410 insertions, 446 deletions
diff --git a/test/benchmarks/src/scala/collection/parallel/benchmarks/arrays/Resetting.scala b/test/benchmarks/src/scala/collection/parallel/benchmarks/arrays/Resetting.scala index e6feb59fcd..22d2107f62 100644 --- a/test/benchmarks/src/scala/collection/parallel/benchmarks/arrays/Resetting.scala +++ b/test/benchmarks/src/scala/collection/parallel/benchmarks/arrays/Resetting.scala @@ -4,19 +4,19 @@ package scala.collection.parallel.benchmarks.arrays import scala.collection.parallel.benchmarks._ -abstract class Resetting[T: Manifest](elemcreate: Int => T, sz: Int, p: Int, what: String) +abstract class Resetting[T: ClassTag](elemcreate: Int => T, sz: Int, p: Int, what: String) extends Bench { val size = sz val parallelism = p val runWhat = what - + var anyarray: Array[Any] = null var castarray: AnyRef = null var gencastarray: Array[T] = null var manifarray: Array[T] = null - + reset - + def reset = what match { case "any" => anyarray = new Array[Any](sz) diff --git a/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/MatrixMultiplication.scala b/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/MatrixMultiplication.scala index 5f902ff483..6d5b189c3a 100644 --- a/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/MatrixMultiplication.scala +++ b/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/MatrixMultiplication.scala @@ -16,54 +16,54 @@ class MatrixMultiplication(sz: Int, p: Int, what: String) extends Resettable(sz, p, what, new Cont(_), new Array[Any](_), classOf[Cont]) { def companion = MatrixMultiplication collection.parallel.tasksupport.environment = forkjoinpool - + val a = Matrix.unit[Int](sz) val b = Matrix.unit[Int](sz) var c = new Matrix[Int](sz) - + def runpar = c = a * b //{ c.assignProduct(a, b) } //; println("--------"); c.output } def runseq = throw new UnsupportedOperationException def comparisonMap = collection.Map() - - class Matrix[T](n: Int)(implicit num: Numeric[T], man: Manifest[T]) { + + class Matrix[T](n: Int)(implicit num: Numeric[T], tag: ClassTag[T]) { val array = new Array[T](n * n) - + def apply(y: Int, x: Int) = array(y * n + x) - + def update(y: Int, x: Int, elem: T) = array(y * n + x) = elem - + def *(b: Matrix[T]) = { val m = new Matrix[T](n) m.assignProduct(this, b) m } - + def assignProduct(a: Matrix[T], b: Matrix[T]) = { val range = ParRange(0, n * n, 1, false) for (i <- range) this(i / n, i % n) = calcProduct(a, b, i / n, i % n); } - + private def calcProduct(a: Matrix[T], b: Matrix[T], y: Int, x: Int): T = { import num._ var sum = zero for (i <- 0 until n) sum += a(y, i) * b(i, x) sum } - + def output = for (y <- 0 until n) { for (x <- 0 until n) print(this(y, x)) println } } - + object Matrix { - def unit[T](n: Int)(implicit num: Numeric[T], man: Manifest[T]) = { + def unit[T](n: Int)(implicit num: Numeric[T], tag: ClassTag[T]) = { val m = new Matrix[T](n) for (i <- 0 until n) m(i, i) = num.one m } } - + } diff --git a/test/disabled/presentation/akka.check b/test/disabled/presentation/akka.check index 9cd20ffb1c..5105d85a00 100644 --- a/test/disabled/presentation/akka.check +++ b/test/disabled/presentation/akka.check @@ -153,11 +153,11 @@ retrieved 131 members `method spawn(clazz: Class[_ <: akka.actor.Actor])akka.actor.ActorRef` `method spawnLink(clazz: Class[_ <: akka.actor.Actor])akka.actor.ActorRef` `method spawnLinkRemote(clazz: Class[_ <: akka.actor.Actor], hostname: String, port: Int, timeout: Long)akka.actor.ActorRef` -`method spawnLinkRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$4: Manifest[T])akka.actor.ActorRef` -`method spawnLink[T <: akka.actor.Actor](implicit evidence$3: Manifest[T])akka.actor.ActorRef` +`method spawnLinkRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$4: ClassTag[T])akka.actor.ActorRef` +`method spawnLink[T <: akka.actor.Actor](implicit evidence$3: ClassTag[T])akka.actor.ActorRef` `method spawnRemote(clazz: Class[_ <: akka.actor.Actor], hostname: String, port: Int, timeout: Long)akka.actor.ActorRef` -`method spawnRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$2: Manifest[T])akka.actor.ActorRef` -`method spawn[T <: akka.actor.Actor](implicit evidence$1: Manifest[T])akka.actor.ActorRef` +`method spawnRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$2: ClassTag[T])akka.actor.ActorRef` +`method spawn[T <: akka.actor.Actor](implicit evidence$1: ClassTag[T])akka.actor.ActorRef` `method start()akka.actor.ActorRef` `method startLink(actorRef: akka.actor.ActorRef)Unit` `method stop()Unit` @@ -286,11 +286,11 @@ retrieved 131 members `method spawn(clazz: Class[_ <: akka.actor.Actor])akka.actor.ActorRef` `method spawnLink(clazz: Class[_ <: akka.actor.Actor])akka.actor.ActorRef` `method spawnLinkRemote(clazz: Class[_ <: akka.actor.Actor], hostname: String, port: Int, timeout: Long)akka.actor.ActorRef` -`method spawnLinkRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$4: Manifest[T])akka.actor.ActorRef` -`method spawnLink[T <: akka.actor.Actor](implicit evidence$3: Manifest[T])akka.actor.ActorRef` +`method spawnLinkRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$4: ClassTag[T])akka.actor.ActorRef` +`method spawnLink[T <: akka.actor.Actor](implicit evidence$3: ClassTag[T])akka.actor.ActorRef` `method spawnRemote(clazz: Class[_ <: akka.actor.Actor], hostname: String, port: Int, timeout: Long)akka.actor.ActorRef` -`method spawnRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$2: Manifest[T])akka.actor.ActorRef` -`method spawn[T <: akka.actor.Actor](implicit evidence$1: Manifest[T])akka.actor.ActorRef` +`method spawnRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$2: ClassTag[T])akka.actor.ActorRef` +`method spawn[T <: akka.actor.Actor](implicit evidence$1: ClassTag[T])akka.actor.ActorRef` `method start()akka.actor.ActorRef` `method startLink(actorRef: akka.actor.ActorRef)Unit` `method stop()Unit` @@ -419,11 +419,11 @@ retrieved 131 members `method spawn(clazz: Class[_ <: akka.actor.Actor])akka.actor.ActorRef` `method spawnLink(clazz: Class[_ <: akka.actor.Actor])akka.actor.ActorRef` `method spawnLinkRemote(clazz: Class[_ <: akka.actor.Actor], hostname: String, port: Int, timeout: Long)akka.actor.ActorRef` -`method spawnLinkRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$4: Manifest[T])akka.actor.ActorRef` -`method spawnLink[T <: akka.actor.Actor](implicit evidence$3: Manifest[T])akka.actor.ActorRef` +`method spawnLinkRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$4: ClassTag[T])akka.actor.ActorRef` +`method spawnLink[T <: akka.actor.Actor](implicit evidence$3: ClassTag[T])akka.actor.ActorRef` `method spawnRemote(clazz: Class[_ <: akka.actor.Actor], hostname: String, port: Int, timeout: Long)akka.actor.ActorRef` -`method spawnRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$2: Manifest[T])akka.actor.ActorRef` -`method spawn[T <: akka.actor.Actor](implicit evidence$1: Manifest[T])akka.actor.ActorRef` +`method spawnRemote[T <: akka.actor.Actor](hostname: String, port: Int, timeout: Long)(implicit evidence$2: ClassTag[T])akka.actor.ActorRef` +`method spawn[T <: akka.actor.Actor](implicit evidence$1: ClassTag[T])akka.actor.ActorRef` `method start()akka.actor.ActorRef` `method startLink(actorRef: akka.actor.ActorRef)Unit` `method stop()Unit` diff --git a/test/disabled/presentation/akka/src/akka/actor/Actor.scala b/test/disabled/presentation/akka/src/akka/actor/Actor.scala index b955c4c38b..b9bc51b635 100644 --- a/test/disabled/presentation/akka/src/akka/actor/Actor.scala +++ b/test/disabled/presentation/akka/src/akka/actor/Actor.scala @@ -135,7 +135,7 @@ object Actor extends ListenerManagement { * val actor = actorOf[MyActor].start() * </pre> */ - def actorOf[T <: Actor: Manifest]: ActorRef = actorOf(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]]) + def actorOf[T <: Actor: ClassTag]: ActorRef = actorOf(classTag[T].erasure.asInstanceOf[Class[_ <: Actor]]) /** Creates an ActorRef out of the Actor of the specified Class. * <pre> @@ -481,7 +481,7 @@ private[actor] class AnyOptionAsTypedOption(anyOption: Option[Any]) { /** Convenience helper to cast the given Option of Any to an Option of the given type. Will swallow a possible * ClassCastException and return None in that case. */ - def asSilently[T: Manifest]: Option[T] = narrowSilently[T](anyOption) + def asSilently[T: ClassTag]: Option[T] = narrowSilently[T](anyOption) } /** Marker interface for proxyable actors (such as typed actor). diff --git a/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala b/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala index ff67c9468e..da0b63006a 100644 --- a/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala +++ b/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala @@ -1406,28 +1406,28 @@ trait ScalaActorRef extends ActorRefShared { ref: ActorRef => /** * Atomically create (from actor class) and start an actor. */ - def spawn[T <: Actor: Manifest]: ActorRef = - spawn(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]]) + def spawn[T <: Actor: ClassTag]: ActorRef = + spawn(classTag[T].erasure.asInstanceOf[Class[_ <: Actor]]) /** * Atomically create (from actor class), start and make an actor remote. */ - def spawnRemote[T <: Actor: Manifest](hostname: String, port: Int, timeout: Long): ActorRef = { + def spawnRemote[T <: Actor: ClassTag](hostname: String, port: Int, timeout: Long): ActorRef = { ensureRemotingEnabled - spawnRemote(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]], hostname, port, timeout) + spawnRemote(classTag[T].erasure.asInstanceOf[Class[_ <: Actor]], hostname, port, timeout) } /** * Atomically create (from actor class), start and link an actor. */ - def spawnLink[T <: Actor: Manifest]: ActorRef = - spawnLink(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]]) + def spawnLink[T <: Actor: ClassTag]: ActorRef = + spawnLink(classTag[T].erasure.asInstanceOf[Class[_ <: Actor]]) /** * Atomically create (from actor class), start, link and make an actor remote. */ - def spawnLinkRemote[T <: Actor: Manifest](hostname: String, port: Int, timeout: Long): ActorRef = { + def spawnLinkRemote[T <: Actor: ClassTag](hostname: String, port: Int, timeout: Long): ActorRef = { ensureRemotingEnabled - spawnLinkRemote(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]], hostname, port, timeout) + spawnLinkRemote(classTag[T].erasure.asInstanceOf[Class[_ <: Actor]], hostname, port, timeout) } } diff --git a/test/disabled/presentation/akka/src/akka/actor/ActorRegistry.scala b/test/disabled/presentation/akka/src/akka/actor/ActorRegistry.scala index df335dc8b4..5d649fcd36 100644 --- a/test/disabled/presentation/akka/src/akka/actor/ActorRegistry.scala +++ b/test/disabled/presentation/akka/src/akka/actor/ActorRegistry.scala @@ -5,7 +5,7 @@ package akka.actor import scala.collection.mutable.{ ListBuffer, Map } -import scala.reflect.Manifest +import scala.reflect.ArrayTag import java.util.concurrent.{ ConcurrentSkipListSet, ConcurrentHashMap } import java.util.{ Set => JSet } @@ -74,10 +74,10 @@ final class ActorRegistry private[actor] () extends ListenerManagement { } /** - * Finds all actors that are subtypes of the class passed in as the Manifest argument and supporting passed message. + * Finds all actors that are subtypes of the class passed in as the ClassTag argument and supporting passed message. */ - def actorsFor[T <: Actor](message: Any)(implicit manifest: Manifest[T]): Array[ActorRef] = - filter(a => manifest.erasure.isAssignableFrom(a.actor.getClass) && a.isDefinedAt(message)) + def actorsFor[T <: Actor](message: Any)(implicit classTag: ClassTag[T]): Array[ActorRef] = + filter(a => classTag.erasure.isAssignableFrom(a.actor.getClass) && a.isDefinedAt(message)) /** * Finds all actors that satisfy a predicate. @@ -93,16 +93,16 @@ final class ActorRegistry private[actor] () extends ListenerManagement { } /** - * Finds all actors that are subtypes of the class passed in as the Manifest argument. + * Finds all actors that are subtypes of the class passed in as the ClassTag argument. */ - def actorsFor[T <: Actor](implicit manifest: Manifest[T]): Array[ActorRef] = - actorsFor[T](manifest.erasure.asInstanceOf[Class[T]]) + def actorsFor[T <: Actor](implicit classTag: ClassTag[T]): Array[ActorRef] = + actorsFor[T](classTag.erasure.asInstanceOf[Class[T]]) /** * Finds any actor that matches T. Very expensive, traverses ALL alive actors. */ - def actorFor[T <: Actor](implicit manifest: Manifest[T]): Option[ActorRef] = - find({ case a: ActorRef if manifest.erasure.isAssignableFrom(a.actor.getClass) => a }) + def actorFor[T <: Actor](implicit classTag: ClassTag[T]): Option[ActorRef] = + find({ case a: ActorRef if classTag.erasure.isAssignableFrom(a.actor.getClass) => a }) /** * Finds all actors of type or sub-type specified by the class passed in as the Class argument. @@ -166,21 +166,21 @@ final class ActorRegistry private[actor] () extends ListenerManagement { } /** - * Finds all typed actors that are subtypes of the class passed in as the Manifest argument. + * Finds all typed actors that are subtypes of the class passed in as the ClassTag argument. */ - def typedActorsFor[T <: AnyRef](implicit manifest: Manifest[T]): Array[AnyRef] = { + def typedActorsFor[T <: AnyRef](implicit classTag: ClassTag[T]): Array[AnyRef] = { TypedActorModule.ensureEnabled - typedActorsFor[T](manifest.erasure.asInstanceOf[Class[T]]) + typedActorsFor[T](classTag.erasure.asInstanceOf[Class[T]]) } /** * Finds any typed actor that matches T. */ - def typedActorFor[T <: AnyRef](implicit manifest: Manifest[T]): Option[AnyRef] = { + def typedActorFor[T <: AnyRef](implicit classTag: ClassTag[T]): Option[AnyRef] = { TypedActorModule.ensureEnabled def predicate(proxy: AnyRef): Boolean = { val actorRef = TypedActorModule.typedActorObjectInstance.get.actorFor(proxy) - actorRef.isDefined && manifest.erasure.isAssignableFrom(actorRef.get.actor.getClass) + actorRef.isDefined && classTag.erasure.isAssignableFrom(actorRef.get.actor.getClass) } findTypedActor({ case a: Some[AnyRef] if predicate(a.get) => a }) } @@ -279,7 +279,7 @@ final class ActorRegistry private[actor] () extends ListenerManagement { * * @author Viktor Klang */ -class Index[K <: AnyRef, V <: AnyRef: Manifest] { +class Index[K <: AnyRef, V <: AnyRef: ArrayTag] { private val Naught = Array[V]() //Nil for Arrays private val container = new ConcurrentHashMap[K, JSet[V]] private val emptySet = new ConcurrentSkipListSet[V] diff --git a/test/disabled/presentation/akka/src/akka/event/EventHandler.scala b/test/disabled/presentation/akka/src/akka/event/EventHandler.scala index f3176b7c21..af2fee6c47 100644 --- a/test/disabled/presentation/akka/src/akka/event/EventHandler.scala +++ b/test/disabled/presentation/akka/src/akka/event/EventHandler.scala @@ -115,8 +115,8 @@ object EventHandler extends ListenerManagement { notifyListeners(event) } - def notify[T <: Event: ClassManifest](event: => T) { - if (level >= levelFor(classManifest[T].erasure.asInstanceOf[Class[_ <: Event]])) notifyListeners(event) + def notify[T <: Event: ClassTag](event: => T) { + if (level >= levelFor(classTag[T].erasure.asInstanceOf[Class[_ <: Event]])) notifyListeners(event) } def error(cause: Throwable, instance: AnyRef, message: => String) { diff --git a/test/disabled/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala b/test/disabled/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala index 0c5da82294..5219c49dcb 100644 --- a/test/disabled/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala +++ b/test/disabled/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala @@ -206,8 +206,8 @@ abstract class RemoteSupport extends ListenerManagement with RemoteServerModule * </pre> */ @deprecated("Will be removed after 1.1", "1.1") - def actorOf[T <: Actor: Manifest](host: String, port: Int): ActorRef = - clientManagedActorOf(() => createActorFromClass(manifest.erasure), host, port) + def actorOf[T <: Actor: ClassTag](host: String, port: Int): ActorRef = + clientManagedActorOf(() => createActorFromClass(classTag[T].erasure), host, port) protected def createActorFromClass(clazz: Class[_]): Actor = { import ReflectiveAccess.{ createInstance, noParams, noArgs } diff --git a/test/disabled/presentation/akka/src/akka/util/Helpers.scala b/test/disabled/presentation/akka/src/akka/util/Helpers.scala index 48477426c9..0ff45408d0 100644 --- a/test/disabled/presentation/akka/src/akka/util/Helpers.scala +++ b/test/disabled/presentation/akka/src/akka/util/Helpers.scala @@ -37,7 +37,7 @@ object Helpers { * Convenience helper to cast the given Option of Any to an Option of the given type. Will swallow a possible * ClassCastException and return None in that case. */ - def narrowSilently[T: Manifest](o: Option[Any]): Option[T] = + def narrowSilently[T: ClassTag](o: Option[Any]): Option[T] = try { narrow(o) } catch { diff --git a/test/disabled/presentation/simple-tests.check b/test/disabled/presentation/simple-tests.check index b90dfce77c..cdb80ed987 100644 --- a/test/disabled/presentation/simple-tests.check +++ b/test/disabled/presentation/simple-tests.check @@ -244,7 +244,7 @@ TypeMember(method disable,(s: Tester.this.settings.Setting)scala.collection.muta TypeMember(value disable,Tester.this.settings.MultiStringSetting,false,true,<none>) TypeMember(value elidebelow,Tester.this.settings.IntSetting,false,true,<none>) TypeMember(method embeddedDefaults,(loader: java.lang.ClassLoader)Unit,true,true,<none>) -TypeMember(method embeddedDefaults,[T](implicit evidence$1: Manifest[T])Unit,true,true,<none>) +TypeMember(method embeddedDefaults,[T](implicit evidence$1: ClassTag[T])Unit,true,true,<none>) TypeMember(value encoding,Tester.this.settings.StringSetting,false,true,<none>) TypeMember(method ensuring,(cond: (scala.tools.nsc.Settings) => Boolean,msg: => Any)scala.tools.nsc.Settings,true,false,method any2Ensuring) TypeMember(method ensuring,(cond: (scala.tools.nsc.Settings) => Boolean)scala.tools.nsc.Settings,true,false,method any2Ensuring) diff --git a/test/files/jvm/manifests-new.check b/test/files/jvm/manifests-new.check new file mode 100644 index 0000000000..9fca856970 --- /dev/null +++ b/test/files/jvm/manifests-new.check @@ -0,0 +1,58 @@ +x=(), t=ConcreteTypeTag[Unit], k=TypeRef, s=class Unit
+x=true, t=ConcreteTypeTag[Boolean], k=TypeRef, s=class Boolean
+x=a, t=ConcreteTypeTag[Char], k=TypeRef, s=class Char
+x=1, t=ConcreteTypeTag[Int], k=TypeRef, s=class Int
+x=abc, t=ConcreteTypeTag[String], k=TypeRef, s=class String
+x='abc, t=ConcreteTypeTag[Symbol], k=TypeRef, s=class Symbol
+
+x=List(()), t=ConcreteTypeTag[List[Unit]], k=TypeRef, s=class List
+x=List(true), t=ConcreteTypeTag[List[Boolean]], k=TypeRef, s=class List
+x=List(1), t=ConcreteTypeTag[List[Int]], k=TypeRef, s=class List
+x=List(abc), t=ConcreteTypeTag[List[String]], k=TypeRef, s=class List
+x=List('abc), t=ConcreteTypeTag[List[Symbol]], k=TypeRef, s=class List
+
+x=[Z, t=ConcreteTypeTag[Array[Boolean]], k=TypeRef, s=class Array
+x=[C, t=ConcreteTypeTag[Array[Char]], k=TypeRef, s=class Array
+x=[I, t=ConcreteTypeTag[Array[Int]], k=TypeRef, s=class Array
+x=[Ljava.lang.String;, t=ConcreteTypeTag[Array[String]], k=TypeRef, s=class Array
+x=[Lscala.Symbol;, t=ConcreteTypeTag[Array[Symbol]], k=TypeRef, s=class Array
+
+x=((),()), t=ConcreteTypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2
+x=(true,false), t=ConcreteTypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2
+x=(1,2), t=ConcreteTypeTag[(Int, Int)], k=TypeRef, s=class Tuple2
+x=(abc,xyz), t=ConcreteTypeTag[(String, String)], k=TypeRef, s=class Tuple2
+x=('abc,'xyz), t=ConcreteTypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2
+
+x=Test$, t=ConcreteTypeTag[Test.type], k=TypeRef, s=object Test
+x=scala.collection.immutable.List$, t=ConcreteTypeTag[scala.collection.immutable.List.type], k=TypeRef, s=object List
+
+x=Foo, t=ConcreteTypeTag[Foo[Int]], k=TypeRef, s=class Foo
+x=Foo, t=ConcreteTypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo
+x=Foo, t=ConcreteTypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo
+x=Foo, t=ConcreteTypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo
+
+x=Test1$$anon$1, t=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1>
+x=Test1$$anon$2, t=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1>
+
+()=()
+true=true
+a=a
+1=1
+'abc='abc
+
+List(())=List(())
+List(true)=List(true)
+List('abc)=List('abc)
+
+Array()=Array()
+Array(true)=Array(true)
+Array(a)=Array(a)
+Array(1)=Array(1)
+
+((),())=((),())
+(true,false)=(true,false)
+
+List(List(1), List(2))=List(List(1), List(2))
+
+Array(Array(1), Array(2))=Array(Array(1), Array(2))
+
diff --git a/test/files/jvm/manifests.scala b/test/files/jvm/manifests-new.scala index 935427f5d4..d02f6ee608 100644 --- a/test/files/jvm/manifests.scala +++ b/test/files/jvm/manifests-new.scala @@ -37,11 +37,8 @@ object Test1 extends TestUtil { print(('abc, 'xyz)) println() - // Disabled: should these work? changing the inference for objects from - // "object Test" to "Test.type" drags in a singleton manifest which for - // some reason leads to serialization failure. - // print(Test) - // print(List) + print(Test) + print(List) println() print(new Foo(2)) @@ -69,8 +66,8 @@ object Test2 { println("List('abc)="+load[List[Symbol]](dump(List('abc)))) println() - def loadArray[T](x: Array[Byte])(implicit m: reflect.Manifest[Array[T]]) = - load[Array[T]](x)(m).deep.toString + def loadArray[T](x: Array[Byte])(implicit t: reflect.ClassTag[Array[T]]) = + load[Array[T]](x)(t).deep.toString println("Array()="+loadArray[Int](dump(Array(): Array[Int]))) println("Array(true)="+loadArray[Boolean](dump(Array(true)))) println("Array(a)="+loadArray[Char](dump(Array('a')))) @@ -102,11 +99,11 @@ trait TestUtil { in.readObject().asInstanceOf[A] } import scala.reflect._ - def print[T](x: T)(implicit m: Manifest[T]) { - // manifests are no longer serializable -// val m1: Manifest[T] = read(write(m)) - val m1: Manifest[T] = m + def print[T](x: T)(implicit t: ConcreteTypeTag[T]) { + // todo. type tags are not yet serializable +// val t1: ConcreteTypeTag[T] = read(write(t)) + val t1: ConcreteTypeTag[T] = t val x1 = x.toString.replaceAll("@[0-9a-z]+$", "") - println("x="+x1+", m="+m1+", k="+m1.tpe.kind+", s="+m1.sym.toString) + println("x="+x1+", t="+t1+", k="+t1.tpe.kind+", s="+t1.sym.toString) } } diff --git a/test/files/jvm/manifests.check b/test/files/jvm/manifests.check deleted file mode 100644 index be8ec2bb5b..0000000000 --- a/test/files/jvm/manifests.check +++ /dev/null @@ -1,56 +0,0 @@ -x=(), m=ConcreteTypeTag[Unit], k=TypeRef, s=class Unit
-x=true, m=ConcreteTypeTag[Boolean], k=TypeRef, s=class Boolean
-x=a, m=ConcreteTypeTag[Char], k=TypeRef, s=class Char
-x=1, m=ConcreteTypeTag[Int], k=TypeRef, s=class Int
-x=abc, m=ConcreteTypeTag[String], k=TypeRef, s=class String
-x='abc, m=ConcreteTypeTag[Symbol], k=TypeRef, s=class Symbol
-
-x=List(()), m=ConcreteTypeTag[List[Unit]], k=TypeRef, s=class List
-x=List(true), m=ConcreteTypeTag[List[Boolean]], k=TypeRef, s=class List
-x=List(1), m=ConcreteTypeTag[List[Int]], k=TypeRef, s=class List
-x=List(abc), m=ConcreteTypeTag[List[String]], k=TypeRef, s=class List
-x=List('abc), m=ConcreteTypeTag[List[Symbol]], k=TypeRef, s=class List
-
-x=[Z, m=ConcreteTypeTag[Array[Boolean]], k=TypeRef, s=class Array
-x=[C, m=ConcreteTypeTag[Array[Char]], k=TypeRef, s=class Array
-x=[I, m=ConcreteTypeTag[Array[Int]], k=TypeRef, s=class Array
-x=[Ljava.lang.String;, m=ConcreteTypeTag[Array[String]], k=TypeRef, s=class Array
-x=[Lscala.Symbol;, m=ConcreteTypeTag[Array[Symbol]], k=TypeRef, s=class Array
-
-x=((),()), m=ConcreteTypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2
-x=(true,false), m=ConcreteTypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2
-x=(1,2), m=ConcreteTypeTag[(Int, Int)], k=TypeRef, s=class Tuple2
-x=(abc,xyz), m=ConcreteTypeTag[(String, String)], k=TypeRef, s=class Tuple2
-x=('abc,'xyz), m=ConcreteTypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2
-
-
-x=Foo, m=ConcreteTypeTag[Foo[Int]], k=TypeRef, s=class Foo
-x=Foo, m=ConcreteTypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo
-x=Foo, m=ConcreteTypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo
-x=Foo, m=ConcreteTypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo
-
-x=Test1$$anon$1, m=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1>
-x=Test1$$anon$2, m=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1>
-
-()=()
-true=true
-a=a
-1=1
-'abc='abc
-
-List(())=List(())
-List(true)=List(true)
-List('abc)=List('abc)
-
-Array()=Array()
-Array(true)=Array(true)
-Array(a)=Array(a)
-Array(1)=Array(1)
-
-((),())=((),())
-(true,false)=(true,false)
-
-List(List(1), List(2))=List(List(1), List(2))
-
-Array(Array(1), Array(2))=Array(Array(1), Array(2))
-
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization-new.check index fa51c6a879..fa51c6a879 100644 --- a/test/files/jvm/serialization.check +++ b/test/files/jvm/serialization-new.check diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization-new.scala index 9c2f2acdbf..bb971fdf36 100644 --- a/test/files/jvm/serialization.scala +++ b/test/files/jvm/serialization-new.scala @@ -282,7 +282,7 @@ object Test2_immutable { // Test classes in package "scala.collection.mutable" object Test3_mutable { - import scala.reflect.ClassManifest + import scala.reflect.ArrayTag import scala.collection.mutable.{ ArrayBuffer, ArrayBuilder, ArraySeq, ArrayStack, BitSet, DoubleLinkedList, HashMap, HashSet, History, LinkedList, ListBuffer, Publisher, Queue, @@ -296,21 +296,21 @@ object Test3_mutable { ab1 ++= List("one", "two") val _ab1: ArrayBuffer[String] = read(write(ab1)) check(ab1, _ab1) - + // ArrayBuilder val abu1 = ArrayBuilder.make[Long] - val _abu1: ArrayBuilder[ClassManifest[Long]] = read(write(abu1)) + val _abu1: ArrayBuilder[ArrayTag[Long]] = read(write(abu1)) check(abu1, _abu1) val abu2 = ArrayBuilder.make[Float] - val _abu2: ArrayBuilder[ClassManifest[Float]] = read(write(abu2)) + val _abu2: ArrayBuilder[ArrayTag[Float]] = read(write(abu2)) check(abu2, _abu2) - + // ArraySeq val aq1 = ArraySeq(1, 2, 3) val _aq1: ArraySeq[Int] = read(write(aq1)) check(aq1, _aq1) - + // ArrayStack val as1 = new ArrayStack[Int] as1 ++= List(20, 2, 3).iterator @@ -381,12 +381,12 @@ object Test3_mutable { val wa1 = WrappedArray.make(Array(1, 2, 3)) val _wa1: WrappedArray[Int] = read(write(wa1)) check(wa1, _wa1) - + // TreeSet val ts1 = TreeSet[Int]() ++= Array(1, 2, 3) val _ts1: TreeSet[Int] = read(write(ts1)) check(ts1, _ts1) - + // concurrent.TrieMap val ct1 = TrieMap[Int, String]() ++= Array(1 -> "one", 2 -> "two", 3 -> "three") val _ct1: TrieMap[Int, String] = read(write(ct1)) @@ -548,7 +548,7 @@ class WithTransient extends Serializable { @transient private lazy val a2 = 2 @transient object B extends Serializable @transient private object C extends Serializable - + def test = { println(a1) println(a2) @@ -594,55 +594,55 @@ object Test { // Test classes in package "scala.collection.parallel" and subpackages object Test9_parallel { import scala.collection.parallel._ - + try { println() - + // UnrolledBuffer val ub = new collection.mutable.UnrolledBuffer[String] ub ++= List("one", "two") val _ub: collection.mutable.UnrolledBuffer[String] = read(write(ub)) check(ub, _ub) - + // mutable.ParArray val pa = mutable.ParArray("abc", "def", "etc") val _pa: mutable.ParArray[String] = read(write(pa)) check(pa, _pa) - + // mutable.ParHashMap val mpm = mutable.ParHashMap(1 -> 2, 2 -> 4) val _mpm: mutable.ParHashMap[Int, Int] = read(write(mpm)) check(mpm, _mpm) - + // mutable.ParTrieMap val mpc = mutable.ParTrieMap(1 -> 2, 2 -> 4) val _mpc: mutable.ParTrieMap[Int, Int] = read(write(mpc)) check(mpc, _mpc) - + // mutable.ParHashSet val mps = mutable.ParHashSet(1, 2, 3) val _mps: mutable.ParHashSet[Int] = read(write(mps)) check(mps, _mps) - + // immutable.ParRange val pr1 = immutable.ParRange(0, 4, 1, true) val _pr1: immutable.ParRange = read(write(pr1)) check(pr1, _pr1) - + val pr2 = immutable.ParRange(0, 4, 1, false) val _pr2: immutable.ParRange = read(write(pr2)) check(pr2, _pr2) - + // immutable.ParHashMap val ipm = immutable.ParHashMap(5 -> 1, 10 -> 2) val _ipm: immutable.ParHashMap[Int, Int] = read(write(ipm)) check(ipm, _ipm) - + // immutable.ParHashSet val ips = immutable.ParHashSet("one", "two") val _ips: immutable.ParHashSet[String] = read(write(ips)) check(ips, _ips) - + } catch { case e: Exception => println("Error in Test5_parallel: " + e) diff --git a/test/files/neg/t2386.check b/test/files/neg/t2386.check deleted file mode 100644 index f70f12535f..0000000000 --- a/test/files/neg/t2386.check +++ /dev/null @@ -1,4 +0,0 @@ -t2386.scala:2: error: No ClassTag available for Array[_ >: String with Int]
- val a = Array(Array(1, 2), Array("a","b"))
- ^
-one error found
diff --git a/test/files/neg/t2386.scala b/test/files/neg/t2386.scala deleted file mode 100644 index 56146cc5c3..0000000000 --- a/test/files/neg/t2386.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test { - val a = Array(Array(1, 2), Array("a","b")) -} diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check new file mode 100644 index 0000000000..e013daca74 --- /dev/null +++ b/test/files/neg/t3692-new.check @@ -0,0 +1,4 @@ +t3692-new.scala:15: error: unreachable code
+ case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
+ ^
+one error found
diff --git a/test/files/neg/t3692.flags b/test/files/neg/t3692-new.flags index 82becdfbfd..82becdfbfd 100644 --- a/test/files/neg/t3692.flags +++ b/test/files/neg/t3692-new.flags diff --git a/test/files/neg/t3692.scala b/test/files/neg/t3692-new.scala index 151535ae94..46874b02e3 100644 --- a/test/files/neg/t3692.scala +++ b/test/files/neg/t3692-new.scala @@ -1,14 +1,14 @@ import java.lang.Integer -object ManifestTester { +object Tester { def main(args: Array[String]) = { val map = Map("John" -> 1, "Josh" -> 2) - new ManifestTester().toJavaMap(map) + new Tester().toJavaMap(map) } } -class ManifestTester { - private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { +class Tester { + private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: ClassTag[T], m2: ClassTag[V]): java.util.Map[_, _] = { map match { case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] case m1: Map[Int, V] => new java.util.HashMap[Integer, V] diff --git a/test/files/neg/t3692.check b/test/files/neg/t3692.check deleted file mode 100644 index d83abd31e2..0000000000 --- a/test/files/neg/t3692.check +++ /dev/null @@ -1,11 +0,0 @@ -t3692.scala:11: warning: type Manifest in object Predef is deprecated: Use `@scala.reflect.ConcreteTypeTag` instead
- private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
- ^
-t3692.scala:11: warning: type Manifest in object Predef is deprecated: Use `@scala.reflect.ConcreteTypeTag` instead
- private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
- ^
-t3692.scala:15: error: unreachable code
- case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
- ^
-two warnings found
-one error found
diff --git a/test/files/neg/t5452-new.check b/test/files/neg/t5452-new.check new file mode 100644 index 0000000000..bbd3734f74 --- /dev/null +++ b/test/files/neg/t5452-new.check @@ -0,0 +1,8 @@ +t5452-new.scala:28: error: overloaded method value apply with alternatives:
+ ()Queryable[CoffeesTable] <and>
+ (t: Tree)(implicit evidence$2: ClassTag[CoffeesTable])Nothing <and>
+ (implicit evidence$1: ClassTag[CoffeesTable])Nothing
+ cannot be applied to (Queryable[CoffeesTable])
+ Queryable[CoffeesTable]( q.treeFilter(null) )
+ ^
+one error found
diff --git a/test/files/neg/t5452.scala b/test/files/neg/t5452-new.scala index 1032db7a4b..c829de7d7c 100644 --- a/test/files/neg/t5452.scala +++ b/test/files/neg/t5452-new.scala @@ -15,8 +15,8 @@ case class Queryable[T]() { } object Queryable { - def apply[T:Manifest] = ??? - def apply[T:Manifest]( t:Tree ) = ??? + def apply[T:ClassTag] = ??? + def apply[T:ClassTag]( t:Tree ) = ??? } trait CoffeesTable{ diff --git a/test/files/neg/t5452.check b/test/files/neg/t5452.check deleted file mode 100644 index 2f35a45509..0000000000 --- a/test/files/neg/t5452.check +++ /dev/null @@ -1,8 +0,0 @@ -t5452.scala:28: error: overloaded method value apply with alternatives: - ()Queryable[CoffeesTable] <and> - (t: Tree)(implicit evidence$2: Manifest[CoffeesTable])Nothing <and> - (implicit evidence$1: Manifest[CoffeesTable])Nothing - cannot be applied to (Queryable[CoffeesTable]) - Queryable[CoffeesTable]( q.treeFilter(null) ) - ^ -one error found diff --git a/test/files/pos/contextbounds-implicits.scala b/test/files/pos/contextbounds-implicits-new.scala index f9113ee320..71b3cca36f 100644 --- a/test/files/pos/contextbounds-implicits.scala +++ b/test/files/pos/contextbounds-implicits-new.scala @@ -3,6 +3,6 @@ */ class C { - def f[T: Manifest, S: Manifest](x: T, y: S)(implicit p: C) { } + def f[T: TypeTag, S: TypeTag](x: T, y: S)(implicit p: C) { } } diff --git a/test/files/pos/implicits.scala b/test/files/pos/implicits-new.scala index 2c01dd0ba8..7eb7e100c3 100644 --- a/test/files/pos/implicits.scala +++ b/test/files/pos/implicits-new.scala @@ -45,7 +45,7 @@ object Test1625 { implicit def byName[A](x: =>A) = new Wrapped(x) implicit def byVal[A](x: A) = x - + def main(args: Array[String]) = { // val res:Wrapped = 7 // works @@ -57,7 +57,7 @@ object Test1625 { } object Test2188 { - implicit def toJavaList[A: ClassManifest](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) + implicit def toJavaList[A: ArrayTag](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) val x: java.util.List[String] = List("foo") } @@ -67,23 +67,23 @@ object TestNumericWidening { val x: java.lang.Long = y } -// #2709 -package foo2709 { - class A - class B - - package object bar { - implicit def a2b(a: A): B = new B - } - - package bar { - object test { - new A: B - } - } -} +// #2709 +package foo2709 { + class A + class B + + package object bar { + implicit def a2b(a: A): B = new B + } + + package bar { + object test { + new A: B + } + } +} // Problem with specs object specsProblem { - println(implicitly[Manifest[Class[_]]]) + println(implicitly[ConcreteTypeTag[Class[_]]]) } diff --git a/test/files/pos/manifest1.scala b/test/files/pos/manifest1-new.scala index 8901aa7437..645bd42665 100644 --- a/test/files/pos/manifest1.scala +++ b/test/files/pos/manifest1-new.scala @@ -1,7 +1,7 @@ -import scala.reflect.Manifest +import scala.reflect.TypeTag object Test { - def foo[T](x: T)(implicit m: Manifest[T]) { + def foo[T](x: T)(implicit m: TypeTag[T]) { foo(List(x)) } foo(1) @@ -13,8 +13,8 @@ object Test { abstract class C { type T = String; val x: T } val c = new C { val x = "abc" } foo(c.x) - abstract class D { type T; implicit val m: Manifest[T]; val x: T } - val stringm = implicitly[Manifest[String]] + abstract class D { type T; implicit val m: TypeTag[T]; val x: T } + val stringm = implicitly[TypeTag[String]] val d: D = new D { type T = String; val m = stringm; val x = "x" } import d.m foo(d.x) diff --git a/test/files/pos/nothing_manifest_disambig-new.scala b/test/files/pos/nothing_manifest_disambig-new.scala new file mode 100644 index 0000000000..a60b0fdbf8 --- /dev/null +++ b/test/files/pos/nothing_manifest_disambig-new.scala @@ -0,0 +1,10 @@ +object Test { + def mani[T: TypeTag](xs: T) = xs + mani(List()) + + def listElMani[T: TypeTag](xs: List[T]) = xs + listElMani(List()) + + def foo[A, C](m : C)(implicit ev: C <:< Traversable[A], mani: TypeTag[A]): (C, A, TypeTag[A]) = (m, m.head, mani) + foo(List(1,2,3)) +}
\ No newline at end of file diff --git a/test/files/pos/nothing_manifest_disambig.scala b/test/files/pos/nothing_manifest_disambig.scala deleted file mode 100644 index 076742033f..0000000000 --- a/test/files/pos/nothing_manifest_disambig.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test { - def mani[T: Manifest](xs: T) = xs - mani(List()) - - def listElMani[T: Manifest](xs: List[T]) = xs - listElMani(List()) - - def foo[A, C](m : C)(implicit ev: C <:< Traversable[A], mani: Manifest[A]): (C, A, Manifest[A]) = (m, m.head, mani) - foo(List(1,2,3)) -}
\ No newline at end of file diff --git a/test/files/pos/spec-constr.scala b/test/files/pos/spec-constr-new.scala index e908b65a41..7cd02b0680 100644 --- a/test/files/pos/spec-constr.scala +++ b/test/files/pos/spec-constr-new.scala @@ -1,4 +1,4 @@ -class SparseArray2[@specialized(Int) T:ClassManifest](val maxSize: Int, initialLength:Int = 3) { +class SparseArray2[@specialized(Int) T:ArrayTag](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-doubledef.scala b/test/files/pos/spec-doubledef-new.scala index 86b0d857d3..33f1e82b6e 100644 --- a/test/files/pos/spec-doubledef.scala +++ b/test/files/pos/spec-doubledef-new.scala @@ -13,7 +13,7 @@ class C extends A[Int] { override def getWith[@specialized(Int) Z](f: Int => Z) = f(value) } -abstract class B[T, @specialized(scala.Int) U : Manifest, @specialized(scala.Int) V <% Ordered[V]] { +abstract class B[T, @specialized(scala.Int) U : TypeTag, @specialized(scala.Int) V <% Ordered[V]] { val u: U val v: V diff --git a/test/files/pos/spec-fields.scala b/test/files/pos/spec-fields-new.scala index 26a8c4ffbd..ddd8bd6624 100644 --- a/test/files/pos/spec-fields.scala +++ b/test/files/pos/spec-fields-new.scala @@ -1,4 +1,4 @@ -abstract class Foo[@specialized T: ClassManifest, U <: Ordered[U]](x: T, size: Int) { +abstract class Foo[@specialized T: ArrayTag, U <: Ordered[U]](x: T, size: Int) { var y: T var z: T = x diff --git a/test/files/pos/spec-params.scala b/test/files/pos/spec-params-new.scala index f522512846..5fe0c82d40 100644 --- a/test/files/pos/spec-params.scala +++ b/test/files/pos/spec-params-new.scala @@ -1,4 +1,4 @@ -class Foo[@specialized A: ClassManifest] { +class Foo[@specialized A: ArrayTag] { // conflicting in bounds, expect a normalized member calling m // and bridge + implementation in specialized subclasses @@ -10,7 +10,7 @@ class Foo[@specialized A: ClassManifest] { def m2[@specialized B <: String](x: B) = x.concat("a") // conflicting in bounds, no mention of other spec members - // expect an overload here plus implementation in + // expect an overload here plus implementation in // compatible specialized subclasses def m3[@specialized B >: A](x: B) = () @@ -19,10 +19,10 @@ class Foo[@specialized A: ClassManifest] { // non-conflicting, expect a normalized overload implementation here def m5[@specialized B](x: B) = x - + // non-conflicting, expect a normalized implementation here // and specialized implementations for all expansions in specialized subclasses - def m6[@specialized B](x: B, y: A) = + def m6[@specialized B](x: B, y: A) = goal(y) def goal(x: A) = { diff --git a/test/files/pos/spec-sparsearray.scala b/test/files/pos/spec-sparsearray-new.scala index ea7710a785..0659bf7926 100644 --- a/test/files/pos/spec-sparsearray.scala +++ b/test/files/pos/spec-sparsearray-new.scala @@ -1,6 +1,6 @@ import scala.collection.mutable.MapLike -class SparseArray[@specialized(Int) T:ClassManifest] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] { +class SparseArray[@specialized(Int) T:ArrayTag] 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/t1381.scala b/test/files/pos/t1381-new.scala index 0762891898..8781ef4fdb 100644 --- a/test/files/pos/t1381.scala +++ b/test/files/pos/t1381-new.scala @@ -1,4 +1,4 @@ -import scala.reflect.Manifest +import scala.reflect.TypeTag class D[V <: Variable] diff --git a/test/files/pos/t2795.scala b/test/files/pos/t2795-new.scala index 935cb1f444..af9c4e8b1c 100644 --- a/test/files/pos/t2795.scala +++ b/test/files/pos/t2795-new.scala @@ -5,7 +5,7 @@ trait Element[T] { trait Config { type T <: Element[T] - implicit val m: ClassManifest[T] + implicit val m: ArrayTag[T] // XXX Following works fine: // type T <: Element[_] } diff --git a/test/files/pos/t3363.scala b/test/files/pos/t3363-new.scala index bae54084ea..270462745c 100755..100644 --- a/test/files/pos/t3363.scala +++ b/test/files/pos/t3363-new.scala @@ -7,12 +7,12 @@ object TestCase { //if you inherit from MapOps[T] instead of MapOps[F] then code compiles fine implicit def map2ops[T,F](fs: Map[T,F]) = new MapOps[F] { //if you remove this line, then code compiles - lazy val m: Manifest[T] = error("just something to make it compile") - def is(xs: List[T]) = List(xs) - } + lazy val m: TypeTag[T] = error("just something to make it compile") + def is(xs: List[T]) = List(xs) + } - def main(args: Array[String]) { - println(Map(1 -> "2") is List(2)) - } + def main(args: Array[String]) { + println(Map(1 -> "2") is List(2)) + } - } + } diff --git a/test/files/pos/t3498.scala b/test/files/pos/t3498-new.scala index bcc90ca64c..653c50042a 100644 --- a/test/files/pos/t3498.scala +++ b/test/files/pos/t3498-new.scala @@ -1,4 +1,4 @@ -abstract class A[T, @specialized(scala.Int) U : Manifest] { +abstract class A[T, @specialized(scala.Int) U : ArrayTag] { def f(state: T): Array[U] } diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check index ae202001eb..2b48a80d38 100644 --- a/test/files/presentation/ide-bug-1000531.check +++ b/test/files/presentation/ide-bug-1000531.check @@ -99,7 +99,7 @@ retrieved 123 members `method synchronized[T0](x$1: T0)T0` `method take(n: Int)Iterator[B]` `method takeWhile(p: B => Boolean)Iterator[B]` -`method toArray[B >: B](implicit evidence$1: ClassManifest[B])Array[B]` +`method toArray[B >: B](implicit evidence$1: ArrayTag[B])Array[B]` `method toBuffer[B >: B]=> scala.collection.mutable.Buffer[B]` `method toIndexedSeq=> scala.collection.immutable.IndexedSeq[B]` `method toIterable=> Iterable[B]` diff --git a/test/files/run/arrayclone.scala b/test/files/run/arrayclone-new.scala index c9f7556b47..a4ba021409 100644 --- a/test/files/run/arrayclone.scala +++ b/test/files/run/arrayclone-new.scala @@ -16,7 +16,7 @@ object BooleanArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = false; - assert(it(0) == true) + assert(it(0) == true) } object ByteArrayClone{ @@ -24,7 +24,7 @@ object ByteArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object ShortArrayClone{ @@ -32,7 +32,7 @@ object ShortArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object CharArrayClone{ @@ -40,7 +40,7 @@ object CharArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object IntArrayClone{ @@ -48,7 +48,7 @@ object IntArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object LongArrayClone{ @@ -56,7 +56,7 @@ object LongArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object FloatArrayClone{ @@ -64,7 +64,7 @@ object FloatArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object DoubleArrayClone{ @@ -72,7 +72,7 @@ object DoubleArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object ObjectArrayClone{ @@ -80,7 +80,7 @@ object ObjectArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = "0"; - assert(it(0) == "1") + assert(it(0) == "1") } object PolymorphicArrayClone{ @@ -88,14 +88,14 @@ object PolymorphicArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = zero; - assert(it(0) == one) - } + assert(it(0) == one) + } testIt(Array("one", "two"), "one", "two"); - class Mangler[T: Manifest](ts : T*){ + class Mangler[T: ArrayTag](ts : T*){ // this will always be a BoxedAnyArray even after we've unboxed its contents. - val it = ts.toArray[T]; + val it = ts.toArray[T]; } val mangled = new Mangler[Int](0, 1); diff --git a/test/files/run/ctries/DumbHash.scala b/test/files/run/ctries-new/DumbHash.scala index 8ef325b67c..8ef325b67c 100644 --- a/test/files/run/ctries/DumbHash.scala +++ b/test/files/run/ctries-new/DumbHash.scala diff --git a/test/files/run/ctries/Wrap.scala b/test/files/run/ctries-new/Wrap.scala index 7b645c1612..7b645c1612 100644 --- a/test/files/run/ctries/Wrap.scala +++ b/test/files/run/ctries-new/Wrap.scala diff --git a/test/files/run/ctries/concmap.scala b/test/files/run/ctries-new/concmap.scala index 3ec0256afb..3ec0256afb 100644 --- a/test/files/run/ctries/concmap.scala +++ b/test/files/run/ctries-new/concmap.scala diff --git a/test/files/run/ctries/iterator.scala b/test/files/run/ctries-new/iterator.scala index b953a40e00..b953a40e00 100644 --- a/test/files/run/ctries/iterator.scala +++ b/test/files/run/ctries-new/iterator.scala diff --git a/test/files/run/ctries/lnode.scala b/test/files/run/ctries-new/lnode.scala index 92a31088e5..92a31088e5 100644 --- a/test/files/run/ctries/lnode.scala +++ b/test/files/run/ctries-new/lnode.scala diff --git a/test/files/run/ctries/main.scala b/test/files/run/ctries-new/main.scala index 8db7fcef54..1d40dab6c5 100644 --- a/test/files/run/ctries/main.scala +++ b/test/files/run/ctries-new/main.scala @@ -6,40 +6,40 @@ object Test { - + def main(args: Array[String]) { ConcurrentMapSpec.test() IteratorSpec.test() LNodeSpec.test() SnapshotSpec.test() } - + } trait Spec { - + implicit def str2ops(s: String) = new { def in[U](body: =>U) { // just execute body body } } - + implicit def any2ops(a: Any) = new { def shouldEqual(other: Any) = assert(a == other) } - + def evaluating[U](body: =>U) = new { - def shouldProduce[T <: Throwable: ClassManifest]() = { + def shouldProduce[T <: Throwable: ClassTag]() = { var produced = false try body catch { - case e => if (e.getClass == implicitly[ClassManifest[T]].erasure) produced = true + case e => if (e.getClass == implicitly[ClassTag[T]].erasure) produced = true } finally { - assert(produced, "Did not produce exception of type: " + implicitly[ClassManifest[T]]) + assert(produced, "Did not produce exception of type: " + implicitly[ClassTag[T]]) } } } - + } diff --git a/test/files/run/ctries/snapshot.scala b/test/files/run/ctries-new/snapshot.scala index 5fe77d445b..5fe77d445b 100644 --- a/test/files/run/ctries/snapshot.scala +++ b/test/files/run/ctries-new/snapshot.scala diff --git a/test/files/run/existentials3.check b/test/files/run/existentials3-new.check index e2c9382ab4..66674fbbd6 100644 --- a/test/files/run/existentials3.check +++ b/test/files/run/existentials3-new.check @@ -1,24 +1,24 @@ -ConcreteTypeTag[Bar.type], t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton
-ConcreteTypeTag[Bar], t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar}
-ConcreteTypeTag[Test.ToS], t=RefinedType, s=f3
-ConcreteTypeTag[Test.ToS], t=RefinedType, s=f4
-ConcreteTypeTag[Test.ToS], t=RefinedType, s=f5
-ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0
-ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0
-ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with Test.ToS
-ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with A with Test.ToS
-TypeTag[List[Object{type T1}#T1]], t=TypeRef, s=class List
-ConcreteTypeTag[List[Seq[Int]]], t=TypeRef, s=class List
-ConcreteTypeTag[List[Seq[U forSome { type U <: Int }]]], t=TypeRef, s=class List
-ConcreteTypeTag[Bar.type], t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton
-ConcreteTypeTag[Bar], t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar}
-ConcreteTypeTag[Test.ToS], t=RefinedType, s=g3
-ConcreteTypeTag[Test.ToS], t=RefinedType, s=g4
-ConcreteTypeTag[Test.ToS], t=RefinedType, s=g5
-ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0
-ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0
-ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with Test.ToS
-ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with A with Test.ToS
-TypeTag[List[Object{type T1}#T1]], t=TypeRef, s=class List
-ConcreteTypeTag[List[Seq[Int]]], t=TypeRef, s=class List
-ConcreteTypeTag[List[Seq[U forSome { type U <: Int }]]], t=TypeRef, s=class List
+ConcreteTypeTag[Bar.type], t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton +ConcreteTypeTag[Bar], t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar} +ConcreteTypeTag[Test.ToS], t=RefinedType, s=f3 +ConcreteTypeTag[Test.ToS], t=RefinedType, s=f4 +ConcreteTypeTag[Test.ToS], t=RefinedType, s=f5 +ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 +ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 +ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with Test.ToS +ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with A with Test.ToS +TypeTag[List[Object{type T1}#T1]], t=TypeRef, s=class List +ConcreteTypeTag[List[Seq[Int]]], t=TypeRef, s=class List +ConcreteTypeTag[List[Seq[U forSome { type U <: Int }]]], t=TypeRef, s=class List +ConcreteTypeTag[Bar.type], t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton +ConcreteTypeTag[Bar], t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar} +ConcreteTypeTag[Test.ToS], t=RefinedType, s=g3 +ConcreteTypeTag[Test.ToS], t=RefinedType, s=g4 +ConcreteTypeTag[Test.ToS], t=RefinedType, s=g5 +ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 +ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 +ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with Test.ToS +ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with A with Test.ToS +TypeTag[List[Object{type T1}#T1]], t=TypeRef, s=class List +ConcreteTypeTag[List[Seq[Int]]], t=TypeRef, s=class List +ConcreteTypeTag[List[Seq[U forSome { type U <: Int }]]], t=TypeRef, s=class List diff --git a/test/files/run/existentials3.scala b/test/files/run/existentials3-new.scala index d6d5612687..32129a04c6 100644 --- a/test/files/run/existentials3.scala +++ b/test/files/run/existentials3-new.scala @@ -38,8 +38,7 @@ object Test { def m[T: ConcreteTypeTag](x: T) = printTag(concreteTypeTag[T]) def m2[T: TypeTag](x: T) = printTag(typeTag[T]) - // manifests don't work for f10/g10 - // oh, they do now :) + // tags do work for f10/g10 def main(args: Array[String]): Unit = { m(f1) m(f2) diff --git a/test/files/run/getClassTest.check b/test/files/run/getClassTest-new.check index 94e86c3889..94e86c3889 100644 --- a/test/files/run/getClassTest.check +++ b/test/files/run/getClassTest-new.check diff --git a/test/files/run/getClassTest.scala b/test/files/run/getClassTest-new.scala index 2485cd2c71..89778ca2d3 100644 --- a/test/files/run/getClassTest.scala +++ b/test/files/run/getClassTest-new.scala @@ -4,7 +4,7 @@ class AnyVals { def f3 = 5.getClass def f4 = (5: java.lang.Integer).getClass def f5 = (5.asInstanceOf[AnyRef]).getClass - + // scalap says: // // def f1 : java.lang.Class[?0] forSome {type ?0} = { /* compiled code */ } @@ -19,18 +19,18 @@ class AnyVals { // f2: java.lang.Class<?> // f3: java.lang.Class<java.lang.Object> // f4: java.lang.Class<? extends java.lang.Integer> - // f5: java.lang.Class<?> + // f5: java.lang.Class<?> } class AnyRefs { class A class B extends A - + def f1 = (new B: Any).getClass().newInstance() def f2 = (new B: AnyRef).getClass().newInstance() def f3 = (new B: A).getClass().newInstance() def f4 = (new B: B).getClass().newInstance() - + def f0[T >: B] = (new B: T).getClass().newInstance() def f5 = f0[Any] @@ -51,8 +51,8 @@ class MoreAnyRefs { } object Test { - def returnTypes[T: Manifest] = ( - manifest[T].erasure.getMethods.toList + def returnTypes[T: ClassTag] = ( + classTag[T].erasure.getMethods.toList filter (_.getName startsWith "f") sortBy (_.getName) map (m => m.getName + ": " + m.getGenericReturnType.toString) diff --git a/test/files/run/manifests.scala b/test/files/run/manifests-new.scala index 2d64bf18a9..4485ce9124 100644 --- a/test/files/run/manifests.scala +++ b/test/files/run/manifests-new.scala @@ -11,7 +11,7 @@ object Test import SubtypeRelationship.{ NONE, SAME, SUB, SUPER } class VarianceTester[T, U, CC[_]](expected: Variances.Value)( - implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) { + implicit ev1: TypeTag[T], ev2: TypeTag[U], ev3: TypeTag[CC[T]], ev4: TypeTag[CC[U]]) { def elements = List(ev1.tpe <:< ev2.tpe, ev2.tpe <:< ev1.tpe) def containers = List(ev3.tpe <:< ev4.tpe, ev4.tpe <:< ev3.tpe) @@ -37,42 +37,40 @@ object Test } } - def showsCovariance[T, U, CC[_]](implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) = + def showsCovariance[T, U, CC[_]](implicit ev1: TypeTag[T], ev2: TypeTag[U], ev3: TypeTag[CC[T]], ev4: TypeTag[CC[U]]) = new VarianceTester[T, U, CC](CO) showsExpectedVariance - def showsInvariance[T, U, CC[_]](implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) = + def showsInvariance[T, U, CC[_]](implicit ev1: TypeTag[T], ev2: TypeTag[U], ev3: TypeTag[CC[T]], ev4: TypeTag[CC[U]]) = new VarianceTester[T, U, CC](IN) showsExpectedVariance - def showsContravariance[T, U, CC[_]](implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) = + def showsContravariance[T, U, CC[_]](implicit ev1: TypeTag[T], ev2: TypeTag[U], ev3: TypeTag[CC[T]], ev4: TypeTag[CC[U]]) = new VarianceTester[T, U, CC](CONTRA) showsExpectedVariance - def typeCompare[T, U](implicit ev1: Manifest[T], ev2: Manifest[U]) = { - (ev1.tpe <:< ev2.tpe, ev2.tpe <:< ev1.tpe) match { - case (true, true) => SAME - case (true, false) => SUB - case (false, true) => SUPER - case (false, false) => NONE - } + def typeCompare[T, U](implicit ev1: TypeTag[T], ev2: TypeTag[U]) = (ev1.tpe <:< ev2.tpe, ev2.tpe <:< ev1.tpe) match { + case (true, true) => SAME + case (true, false) => SUB + case (false, true) => SUPER + case (false, false) => NONE } - def assertAnyRef[T: Manifest] = List( - manifest[T].tpe <:< manifest[Any].tpe, - manifest[T].tpe <:< manifest[AnyRef].tpe, - !(manifest[T].tpe <:< manifest[AnyVal].tpe) + def assertAnyRef[T: TypeTag] = List( + typeTag[T].tpe <:< typeTag[Any].tpe, + typeTag[T].tpe <:< typeTag[AnyRef].tpe, + !(typeTag[T].tpe <:< typeTag[AnyVal].tpe) ) foreach (assert(_, "assertAnyRef")) - def assertAnyVal[T: Manifest] = List( - manifest[T].tpe <:< manifest[Any].tpe, - !(manifest[T].tpe <:< manifest[AnyRef].tpe), - manifest[T].tpe <:< manifest[AnyVal].tpe + def assertAnyVal[T: TypeTag] = List( + typeTag[T].tpe <:< typeTag[Any].tpe, + !(typeTag[T].tpe <:< typeTag[AnyRef].tpe), + typeTag[T].tpe <:< typeTag[AnyVal].tpe ) foreach (assert(_, "assertAnyVal")) - def assertSameType[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == SAME, "assertSameType") - def assertSuperType[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == SUPER, "assertSuperType") - def assertSubType[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == SUB, "assertSubType") - def assertNoRelationship[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == NONE, "assertNoRelationship") + def assertSameType[T: TypeTag, U: TypeTag] = assert(typeCompare[T, U] == SAME, "assertSameType") + def assertSuperType[T: TypeTag, U: TypeTag] = assert(typeCompare[T, U] == SUPER, "assertSuperType") + def assertSubType[T: TypeTag, U: TypeTag] = assert(typeCompare[T, U] == SUB, "assertSubType") + def assertNoRelationship[T: TypeTag, U: TypeTag] = assert(typeCompare[T, U] == NONE, "assertNoRelationship") - def testVariancesVia[T: Manifest, U: Manifest] = assert( + def testVariancesVia[T: TypeTag, U: TypeTag] = assert( typeCompare[T, U] == SUB && showsCovariance[T, U, List] && showsInvariance[T, U, Set], diff --git a/test/files/run/patmat_unapp_abstype.check b/test/files/run/patmat_unapp_abstype-new.check index 72239d16cd..72239d16cd 100644 --- a/test/files/run/patmat_unapp_abstype.check +++ b/test/files/run/patmat_unapp_abstype-new.check diff --git a/test/files/run/patmat_unapp_abstype.flags b/test/files/run/patmat_unapp_abstype-new.flags index ba80cad69b..ba80cad69b 100644 --- a/test/files/run/patmat_unapp_abstype.flags +++ b/test/files/run/patmat_unapp_abstype-new.flags diff --git a/test/files/run/patmat_unapp_abstype.scala b/test/files/run/patmat_unapp_abstype-new.scala index 45496f08a2..45496f08a2 100644 --- a/test/files/run/patmat_unapp_abstype.scala +++ b/test/files/run/patmat_unapp_abstype-new.scala diff --git a/test/files/run/primitive-sigs-2.check b/test/files/run/primitive-sigs-2-new.check index 1b6e24ed20..b82ddbeaff 100644 --- a/test/files/run/primitive-sigs-2.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.api.TypeTags.scala.reflect.api.TypeTags$ConcreteTypeTag<T>)
+public <T> java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.ArrayTag<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.scala b/test/files/run/primitive-sigs-2-new.scala index b7152f7e3d..7e13014cb2 100644 --- a/test/files/run/primitive-sigs-2.scala +++ b/test/files/run/primitive-sigs-2-new.scala @@ -10,22 +10,14 @@ 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) - // This gets a signature like - // public <T> java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.Manifest<T>) - // - // instead of the more appealing version from the past - // public <T> T[] Arr.arr4(T[][],scala.reflect.Manifest<T>) - // - // because java inflict's its reference-only generic-arrays on us. - // - def arr4[T: Manifest](xss: Array[Array[T]]): Array[T] = xss map (_.head) + def arr4[T: ArrayTag](xss: Array[Array[T]]): Array[T] = xss map (_.head) } object Test { val c1: Class[_] = classOf[T[_]] val c2: Class[_] = classOf[C] val c3: Class[_] = classOf[Arr] - + val c1m = c1.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString) val c2m = c2.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString) val c3m = c3.getDeclaredMethods.toList map (_.toGenericString) diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass-new.scala index 7718b52f33..27374f2106 100644 --- a/test/files/run/reflection-implClass.scala +++ b/test/files/run/reflection-implClass-new.scala @@ -1,5 +1,5 @@ -/** - * Tries to load a symbol for the `Foo$class` using Scala reflection. +/** + * Tries to load a symbol for the `Foo$class` using Scala reflection. * Since trait implementation classes do not get pickling information * symbol for them should be created using fallback mechanism * that exposes Java reflection information dressed up in @@ -8,15 +8,15 @@ object Test extends App with Outer { import scala.reflect.mirror - assert(mirror.classToSymbol(manifest[Foo].erasure).typeSignature.declaration(mirror.newTermName("bar")).typeSignature == - mirror.classToSymbol(manifest[Bar].erasure).typeSignature.declaration(mirror.newTermName("foo")).typeSignature) + assert(mirror.classToSymbol(classTag[Foo].erasure).typeSignature.declaration(mirror.newTermName("bar")).typeSignature == + mirror.classToSymbol(classTag[Bar].erasure).typeSignature.declaration(mirror.newTermName("foo")).typeSignature) - val s1 = implClass(manifest[Foo].erasure) + val s1 = implClass(classTag[Foo].erasure) assert(s1 != mirror.NoSymbol) assert(s1.typeSignature != mirror.NoType) assert(s1.companionSymbol.typeSignature != mirror.NoType) assert(s1.companionSymbol.typeSignature.declaration(mirror.newTermName("bar")) != mirror.NoSymbol) - val s2 = implClass(manifest[Bar].erasure) + val s2 = implClass(classTag[Bar].erasure) assert(s2 != mirror.NoSymbol) assert(s2.typeSignature != mirror.NoType) assert(s2.companionSymbol.typeSignature != mirror.NoType) diff --git a/test/files/run/reify_implicits.check b/test/files/run/reify_implicits-new.check index e3aeb20f6b..e3aeb20f6b 100644 --- a/test/files/run/reify_implicits.check +++ b/test/files/run/reify_implicits-new.check diff --git a/test/files/run/reify_implicits.scala b/test/files/run/reify_implicits-new.scala index 60971c3cfb..69198391d1 100644 --- a/test/files/run/reify_implicits.scala +++ b/test/files/run/reify_implicits-new.scala @@ -2,7 +2,7 @@ import scala.reflect.mirror._ object Test extends App { reify { - implicit def arrayWrapper[A : ClassManifest](x: Array[A]) = + implicit def arrayWrapper[A : ArrayTag](x: Array[A]) = new { def sort(p: (A, A) => Boolean) = { util.Sorting.stableSort(x, p); x diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index 1e7b6f0cd8..c509434116 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -1,32 +1,32 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> :power -** Power User mode enabled - BEEP WHIR GYVE ** -** :phase has been set to 'typer'. ** -** scala.tools.nsc._ has been imported ** -** global._, definitions._ also imported ** -** Try :help, :vals, power.<tab> ** - -scala> // guarding against "error: reference to global is ambiguous" - -scala> global.emptyValDef // "it is imported twice in the same scope by ..." -res0: $r.global.emptyValDef.type = private val _ = _ - -scala> val tp = ArrayClass[scala.util.Random] // magic with manifests -tp: $r.global.Type = Array[scala.util.Random] - -scala> tp.memberType(Array_apply) // evidence -res1: $r.global.Type = (i: Int)scala.util.Random - -scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl -m: $r.treedsl.global.Match = -10 match { - case 5 => false - case _ => true -} - -scala> typed(m).tpe // typed is in scope -res2: $r.treedsl.global.Type = Boolean - -scala> +Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> :power
+** Power User mode enabled - BEEP WHIR GYVE **
+** :phase has been set to 'typer'. **
+** scala.tools.nsc._ has been imported **
+** global._, definitions._ also imported **
+** Try :help, :vals, power.<tab> **
+
+scala> // guarding against "error: reference to global is ambiguous"
+
+scala> global.emptyValDef // "it is imported twice in the same scope by ..."
+res0: $r.global.emptyValDef.type = private val _ = _
+
+scala> val tp = ArrayClass[scala.util.Random] // magic with tags
+tp: $r.global.Type = Array[scala.util.Random]
+
+scala> tp.memberType(Array_apply) // evidence
+res1: $r.global.Type = (i: Int)scala.util.Random
+
+scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl
+m: $r.treedsl.global.Match =
+10 match {
+ case 5 => false
+ case _ => true
+}
+
+scala> typed(m).tpe // typed is in scope
+res2: $r.treedsl.global.Type = Boolean
+
+scala>
diff --git a/test/files/run/repl-power.scala b/test/files/run/repl-power.scala index 27da3df106..f7c88c63ff 100644 --- a/test/files/run/repl-power.scala +++ b/test/files/run/repl-power.scala @@ -5,10 +5,9 @@ object Test extends ReplTest { :power // guarding against "error: reference to global is ambiguous" global.emptyValDef // "it is imported twice in the same scope by ..." -val tp = ArrayClass[scala.util.Random] // magic with manifests +val tp = ArrayClass[scala.util.Random] // magic with tags tp.memberType(Array_apply) // evidence val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl typed(m).tpe // typed is in scope """.trim } - diff --git a/test/files/run/t0421.check b/test/files/run/t0421-new.check index cdcf042f19..cdcf042f19 100644 --- a/test/files/run/t0421.check +++ b/test/files/run/t0421-new.check diff --git a/test/files/run/t0421.scala b/test/files/run/t0421-new.scala index 8d51013924..7de6b7f2c4 100644 --- a/test/files/run/t0421.scala +++ b/test/files/run/t0421-new.scala @@ -1,23 +1,23 @@ // ticket #421 object Test extends App { - def transpose[A: ClassManifest](xss: Array[Array[A]]) = { + def transpose[A: ArrayTag](xss: Array[Array[A]]) = { for (i <- Array.range(0, xss(0).length)) yield for (xs <- xss) yield xs(i) } def scalprod(xs: Array[Double], ys: Array[Double]) = { - var acc = 0.0 - for ((x, y) <- xs zip ys) acc = acc + x * y + var acc = 0.0 + for ((x, y) <- xs zip ys) acc = acc + x * y acc } def matmul(xss: Array[Array[Double]], yss: Array[Array[Double]]) = { - val ysst = transpose(yss) + val ysst = transpose(yss) val ysst1: Array[Array[Double]] = yss.transpose assert(ysst.deep == ysst1.deep) for (xs <- xss) yield - for (yst <- ysst) yield + for (yst <- ysst) yield scalprod(xs, yst) } @@ -25,6 +25,6 @@ object Test extends App { println(transpose(a1).deep.mkString("[", ",", "]")) println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deep.mkString("[", ",", "]")) - + println(matmul(Array(Array(4)), Array(Array(6, 8))).deep.mkString("[", ",", "]")) } diff --git a/test/files/run/t0677.scala b/test/files/run/t0677-new.scala index 6c8a3a7e99..bf7a3971dc 100644 --- a/test/files/run/t0677.scala +++ b/test/files/run/t0677-new.scala @@ -1,5 +1,5 @@ object Test extends App { - class X[T: ClassManifest] { + class X[T: ArrayTag] { val a = Array.ofDim[T](3, 4) } val x = new X[String] diff --git a/test/files/run/t1195.check b/test/files/run/t1195-new.check index 554e3fd03d..554e3fd03d 100644 --- a/test/files/run/t1195.check +++ b/test/files/run/t1195-new.check diff --git a/test/files/run/t1195.scala b/test/files/run/t1195-new.scala index 93b1dcbd07..6f28a4a167 100644 --- a/test/files/run/t1195.scala +++ b/test/files/run/t1195-new.scala @@ -7,7 +7,7 @@ object Test { val g1 = g() val h1 = h() - def m[T: Manifest](x: T) = println(manifest[T] + ", underlying = " + manifest[T].sym.typeSignature) + def m[T: TypeTag](x: T) = println(typeTag[T] + ", underlying = " + typeTag[T].sym.typeSignature) def main(args: Array[String]): Unit = { m(f) diff --git a/test/files/run/t2236.scala b/test/files/run/t2236-new.scala index 64ed18c805..bbabe8e7d9 100755..100644 --- a/test/files/run/t2236.scala +++ b/test/files/run/t2236-new.scala @@ -1,4 +1,4 @@ -class T[A](implicit val m:Manifest[A]) +class T[A](implicit val m:TypeTag[A]) class Foo class Bar extends T[Foo] object Test extends App { diff --git a/test/files/run/t2386-new.check b/test/files/run/t2386-new.check new file mode 100644 index 0000000000..98e226f946 --- /dev/null +++ b/test/files/run/t2386-new.check @@ -0,0 +1,2 @@ +a(0) = Array(1, 2)
+a(1) = Array("a", "b")
diff --git a/test/files/run/t2386-new.scala b/test/files/run/t2386-new.scala new file mode 100644 index 0000000000..15d1859759 --- /dev/null +++ b/test/files/run/t2386-new.scala @@ -0,0 +1,5 @@ +object Test extends App { + val a = Array(Array(1, 2), Array("a","b")) + println("a(0) = Array(" + (a(0) mkString ", ") + ")") + println("a(1) = Array(" + (a(1) map (s => "\"" + s + "\"") mkString ", ") + ")") +} diff --git a/test/files/run/t3507.check b/test/files/run/t3507-new.check index 6e4fa4170e..6e4fa4170e 100644 --- a/test/files/run/t3507.check +++ b/test/files/run/t3507-new.check diff --git a/test/files/run/t3507.scala b/test/files/run/t3507-new.scala index 3cdd40a881..c7a529e8b8 100644 --- a/test/files/run/t3507.scala +++ b/test/files/run/t3507-new.scala @@ -9,7 +9,7 @@ object Test extends App { var a: A = new A // mutable val c /*: object _1.b.c forSome { val _1: A } */ = a.m // widening using existential - def mani[T: Manifest](x: T) = println(manifest[T]) + def mani[T: TypeTag](x: T) = println(typeTag[T]) mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier // --> _1 is not in scope here }
\ No newline at end of file diff --git a/test/files/run/t3758.check b/test/files/run/t3758.check deleted file mode 100644 index 9c6ab655a3..0000000000 --- a/test/files/run/t3758.check +++ /dev/null @@ -1,6 +0,0 @@ -List(String)
-List(Int)
-List(Float)
-List(String)
-List(Int)
-List(Float)
diff --git a/test/files/run/t3758.scala b/test/files/run/t3758.scala deleted file mode 100644 index 10bfb5724b..0000000000 --- a/test/files/run/t3758.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = { - println(classManifest[Array[String]].tpe.typeArguments) - println(classManifest[Array[Int]].tpe.typeArguments) - println(classManifest[Array[Float]].tpe.typeArguments) - println(manifest[Array[String]].tpe.typeArguments) - println(manifest[Array[Int]].tpe.typeArguments) - println(manifest[Array[Float]].tpe.typeArguments) - } -} diff --git a/test/files/run/t4110.check b/test/files/run/t4110-new.check index 28f220e1fe..28f220e1fe 100644 --- a/test/files/run/t4110.check +++ b/test/files/run/t4110-new.check diff --git a/test/files/run/t4110.scala b/test/files/run/t4110-new.scala index 4bd377b73e..3285b82c61 100644 --- a/test/files/run/t4110.scala +++ b/test/files/run/t4110-new.scala @@ -1,9 +1,9 @@ object Test extends App { - def inferredType[T : Manifest](v : T) = println(manifest[T]) + def inferredType[T : TypeTag](v : T) = println(typeTag[T]) trait A trait B - + inferredType(new A with B) val name = new A with B diff --git a/test/files/scalacheck/array.scala b/test/files/scalacheck/array-new.scala index f262bc6320..18d577ca6d 100644 --- a/test/files/scalacheck/array.scala +++ b/test/files/scalacheck/array-new.scala @@ -9,9 +9,9 @@ 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: Manifest[T]): Arbitrary[Array[T]] = + implicit def arbArray[T](implicit a: Arbitrary[T], m: ArrayTag[T]): Arbitrary[Array[T]] = Arbitrary(containerOf[List,T](arbitrary[T]) map (_.toArray)) - + val arrGen: Gen[Array[_]] = oneOf( arbitrary[Array[Int]], arbitrary[Array[Array[Int]]], @@ -20,7 +20,7 @@ object Test extends Properties("Array") { arbitrary[Array[Boolean]], arbitrary[Array[AnyVal]] ) - + // inspired by #1857 and #2352 property("eq/ne") = forAll(arrGen, arrGen) { (c1, c2) => (c1 eq c2) || (c1 ne c2) @@ -32,6 +32,5 @@ object Test extends Properties("Array") { val arr = Array.ofDim[String](i1, i2, i3) val flattened = arr flatMap (x => x) flatMap (x => x) flattened.length == i1 * i2 * i3 - } + } } - diff --git a/test/files/specialized/spec-matrix.check b/test/files/specialized/spec-matrix-new.check index 5ec3e84597..5ec3e84597 100644 --- a/test/files/specialized/spec-matrix.check +++ b/test/files/specialized/spec-matrix-new.check diff --git a/test/files/specialized/spec-matrix.scala b/test/files/specialized/spec-matrix-new.scala index 98735c8c03..65b46e8d48 100644 --- a/test/files/specialized/spec-matrix.scala +++ b/test/files/specialized/spec-matrix-new.scala @@ -1,9 +1,9 @@ /** Test matrix multiplication with specialization. */ -class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) { +class Matrix[@specialized A: ArrayTag](val rows: Int, val cols: Int) { private val arr: Array[Array[A]] = Array.ofDim[A](rows, cols) - + def apply(i: Int, j: Int): A = { if (i < 0 || i >= rows || j < 0 || j >= cols) throw new NoSuchElementException("Indexes out of bounds: " + (i, j)) @@ -29,7 +29,7 @@ object Test { def main(args: Array[String]) { val m = randomMatrix(200, 100) val n = randomMatrix(100, 200) - + val p = mult(m, n) println(p(0, 0)) println("Boxed doubles: " + runtime.BoxesRunTime.doubleBoxCount) @@ -38,7 +38,7 @@ object Test { def randomMatrix(n: Int, m: Int) = { val r = new util.Random(10) - val x = new Matrix[Double](n, m) + val x = new Matrix[Double](n, m) for (i <- 0 until n; j <- 0 until m) x(i, j) = (r.nextInt % 1000).toDouble x @@ -46,17 +46,17 @@ object Test { def printMatrix[Double](m: Matrix[Double]) { for (i <- 0 until m.rows) { - for (j <- 0 until m.cols) + for (j <- 0 until m.cols) print("%5.3f ".format(m(i, j))) println } } - def multManifest[@specialized(Int) T](m: Matrix[T], n: Matrix[T])(implicit cm: ClassManifest[T], num: Numeric[T]) { + def multTag[@specialized(Int) T](m: Matrix[T], n: Matrix[T])(implicit at: ArrayTag[T], num: Numeric[T]) { val p = new Matrix[T](m.rows, n.cols) import num._ - for (i <- 0 until m.rows) + for (i <- 0 until m.rows) for (j <- 0 until n.cols) { var sum = num.zero for (k <- 0 until n.rows) @@ -68,7 +68,7 @@ object Test { def mult(m: Matrix[Double], n: Matrix[Double]) = { val p = new Matrix[Double](m.rows, n.cols) - for (i <- 0 until m.rows) + for (i <- 0 until m.rows) for (j <- 0 until n.cols) { var sum = 0.0 for (k <- 0 until n.rows) diff --git a/test/pending/pos/inference.scala b/test/pending/pos/inference.scala index d28d003435..3672351fca 100644 --- a/test/pending/pos/inference.scala +++ b/test/pending/pos/inference.scala @@ -1,15 +1,15 @@ // inference illuminator object Test { - class D1[T1 : Manifest, T2 <: T1 : Manifest](x: T1) { println(manifest[(T1, T2)]) } - class D2[T1 : Manifest, T2 >: T1 : Manifest](x: T1) { println(manifest[(T1, T2)]) } - class D3[+T1 : Manifest, T2 <: T1 : Manifest](x: T1) { println(manifest[(T1, T2)]) } - class D4[-T1 : Manifest, T2 >: T1 : Manifest](x: T1) { println(manifest[(T1, T2)]) } - - class E1[T1 : Manifest, T2 <: T1 : Manifest](x: D1[T1, T2]) { println(manifest[(T1, T2)]) } - class E2[T1 : Manifest, T2 >: T1 : Manifest](x: D2[T1, T2]) { println(manifest[(T1, T2)]) } - class E3[+T1 : Manifest, T2 <: T1 : Manifest](x: D3[T1, T2]) { println(manifest[(T1, T2)]) } - class E4[-T1 : Manifest, T2 >: T1 : Manifest](x: D4[T1, T2]) { println(manifest[(T1, T2)]) } - + class D1[T1 : TypeTag, T2 <: T1 : TypeTag](x: T1) { println(typeTag[(T1, T2)]) } + class D2[T1 : TypeTag, T2 >: T1 : TypeTag](x: T1) { println(typeTag[(T1, T2)]) } + class D3[+T1 : TypeTag, T2 <: T1 : TypeTag](x: T1) { println(typeTag[(T1, T2)]) } + class D4[-T1 : TypeTag, T2 >: T1 : TypeTag](x: T1) { println(typeTag[(T1, T2)]) } + + class E1[T1 : TypeTag, T2 <: T1 : TypeTag](x: D1[T1, T2]) { println(typeTag[(T1, T2)]) } + class E2[T1 : TypeTag, T2 >: T1 : TypeTag](x: D2[T1, T2]) { println(typeTag[(T1, T2)]) } + class E3[+T1 : TypeTag, T2 <: T1 : TypeTag](x: D3[T1, T2]) { println(typeTag[(T1, T2)]) } + class E4[-T1 : TypeTag, T2 >: T1 : TypeTag](x: D4[T1, T2]) { println(typeTag[(T1, T2)]) } + def main(args: Array[String]): Unit = { // WHY YOU NO LIKE NOTHING SO MUCH SCALAC? val d1 = new D1(5) diff --git a/test/pending/shootout/meteor.scala b/test/pending/shootout/meteor.scala index 2fd702753a..154695533b 100644 --- a/test/pending/shootout/meteor.scala +++ b/test/pending/shootout/meteor.scala @@ -19,7 +19,7 @@ object meteor { -// Solver.scala +// Solver.scala // import scala.collection.mutable._ final class Solver (n: Int) { @@ -29,8 +29,8 @@ final class Solver (n: Int) { private val board = new Board() - val pieces = Array( - new Piece(0), new Piece(1), new Piece(2), new Piece(3), new Piece(4), + val pieces = Array( + new Piece(0), new Piece(1), new Piece(2), new Piece(3), new Piece(4), new Piece(5), new Piece(6), new Piece(7), new Piece(8), new Piece(9) ) val unplaced = new BitSet(pieces.length) @@ -71,8 +71,8 @@ final class Solver (n: Int) { private def puzzleSolved() = { val b = board.asString - if (first == null){ - first = b; last = b + if (first == null){ + first = b; last = b } else { if (b < first){ first = b } else { if (b > last){ last = b } } } @@ -81,7 +81,7 @@ final class Solver (n: Int) { private def shouldPrune() = { board.unmark - !board.cells.forall(c => c.contiguousEmptyCells % Piece.size == 0) + !board.cells.forall(c => c.contiguousEmptyCells % Piece.size == 0) } @@ -108,8 +108,8 @@ final class Solver (n: Int) { } /* - def printPieces() = - for (i <- Iterator.range(0,Board.pieces)) pieces(i).print + def printPieces() = + for (i <- Iterator.range(0,Board.pieces)) pieces(i).print */ } @@ -126,7 +126,7 @@ object Board { val size = rows * cols } -final class Board { +final class Board { val cells = boardCells() val cellsPieceWillFill = new Array[BoardCell](Piece.size) @@ -134,9 +134,9 @@ final class Board { def unmark() = for (c <- cells) c.unmark - def asString() = - new String( cells map( - c => if (c.piece == null) '-'.toByte + def asString() = + new String( cells map( + c => if (c.piece == null) '-'.toByte else (c.piece.number + 48).toByte )) def firstEmptyCellIndex() = cells.findIndexOf(c => c.isEmpty) @@ -144,13 +144,13 @@ final class Board { def add(pieceIndex: Int, boardIndex: Int, p: Piece) = { cellCount = 0 p.unmark - + find( p.cells(pieceIndex), cells(boardIndex)) - val boardHasSpace = cellCount == Piece.size && - cellsPieceWillFill.forall(c => c.isEmpty) + val boardHasSpace = cellCount == Piece.size && + cellsPieceWillFill.forall(c => c.isEmpty) - if (boardHasSpace) cellsPieceWillFill.foreach(c => c.piece = p) + if (boardHasSpace) cellsPieceWillFill.foreach(c => c.piece = p) boardHasSpace } @@ -180,10 +180,10 @@ final class Board { if (row % 2 == 1) { if (!isLast) c.next(Cell.NE) = a(i-(Board.cols-1)) - c.next(Cell.NW) = a(i-Board.cols) + c.next(Cell.NW) = a(i-Board.cols) if (row != m) { if (!isLast) c.next(Cell.SE) = a(i+(Board.cols+1)) - c.next(Cell.SW) = a(i+Board.cols) + c.next(Cell.SW) = a(i+Board.cols) } } else { if (row != 0) { @@ -212,9 +212,9 @@ final class Board { Console.print(i + "\t") for (j <- Iterator.range(0,Cell.sides)){ val c = cells(i).next(j) - if (c == null) - Console.print("-- ") - else + if (c == null) + Console.print("-- ") + else Console.printf("{0,number,00} ")(c.number) } Console.println("") @@ -241,7 +241,7 @@ final class Piece(_number: Int) { val number = _number val cells = for (i <- Array.range(0,Piece.size)) yield new PieceCell() - { + { number match { case 0 => make0 case 1 => make1 @@ -252,7 +252,7 @@ final class Piece(_number: Int) { case 6 => make6 case 7 => make7 case 8 => make8 - case 9 => make9 + case 9 => make9 } } @@ -395,12 +395,12 @@ final class Piece(_number: Int) { Console.print(i + "\t") for (j <- Iterator.range(0,Cell.sides)){ val c = cells(i).next(j) - if (c == null) - Console.print("-- ") - else + if (c == null) + Console.print("-- ") + else for (k <- Iterator.range(0,Piece.size)){ if (cells(k) == c) Console.printf(" {0,number,0} ")(k) - } + } } Console.println("") } @@ -418,13 +418,13 @@ final class Piece(_number: Int) { object Cell { val NW = 0; val NE = 1 val W = 2; val E = 3 - val SW = 4; val SE = 5 + val SW = 4; val SE = 5 val sides = 6 } abstract class Cell { - implicit def m: Manifest[T] + implicit def t: ClassTag[T] type T val next = new Array[T](Cell.sides) var marked = false @@ -437,7 +437,7 @@ abstract class Cell { final class BoardCell(_number: Int) extends { type T = BoardCell - implicit val m = manifest[BoardCell] + implicit val t = classTag[BoardCell] } with Cell { val number = _number var piece: Piece = _ @@ -448,10 +448,10 @@ final class BoardCell(_number: Int) extends { def contiguousEmptyCells(): Int = { if (!marked && isEmpty){ mark - var count = 1 + var count = 1 for (neighbour <- next) - if (neighbour != null && neighbour.isEmpty) + if (neighbour != null && neighbour.isEmpty) count = count + neighbour.contiguousEmptyCells count } else { 0 } diff --git a/test/scaladoc/resources/implicits-base-res.scala b/test/scaladoc/resources/implicits-base-res.scala index 3e3d0f01a6..65d7bdf67c 100644 --- a/test/scaladoc/resources/implicits-base-res.scala +++ b/test/scaladoc/resources/implicits-base-res.scala @@ -137,6 +137,8 @@ class ManifestA[W: Manifest](a: A[W]) { def convToManifestA(x: W): W = sys.error("dunno") } +// [Eugene to Vlad] how do I test typetags here? + /** MyTraversableOps class <br/> * - checks if any abstract members are added - should not happen! */ @@ -144,4 +146,3 @@ trait MyTraversableOps[S] { /** The convToTraversableOps: S documentation... */ def convToTraversableOps(x: S): S } - |