summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-04-23 16:04:56 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-04-23 17:54:50 +0200
commit0f0144c74088e396fc1440166bed5a7c6d5f44f4 (patch)
treefd7cc379f1926a3e6a0b94ccb22dd071384cdeb1
parent2b09d8caf5497c4e016a3e1179e5f7e842766176 (diff)
downloadscala-0f0144c74088e396fc1440166bed5a7c6d5f44f4.tar.gz
scala-0f0144c74088e396fc1440166bed5a7c6d5f44f4.tar.bz2
scala-0f0144c74088e396fc1440166bed5a7c6d5f44f4.zip
migrates stdlib and compiler to tags
* all usages of ClassManifest and Manifest are replaced with tags * all manifest tests are replaced with tag tests
-rw-r--r--src/compiler/scala/reflect/internal/AnnotationInfos.scala3
-rw-r--r--src/compiler/scala/reflect/internal/Definitions.scala4
-rw-r--r--src/compiler/scala/reflect/internal/pickling/UnPickler.scala4
-rw-r--r--src/compiler/scala/reflect/internal/util/Origins.scala2
-rw-r--r--src/compiler/scala/reflect/runtime/Mirror.scala2
-rw-r--r--src/compiler/scala/tools/cmd/FromString.scala6
-rw-r--r--src/compiler/scala/tools/nsc/Phases.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/Settings.scala15
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala8
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala14
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ILoop.scala4
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/IMain.scala23
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/NamedParam.scala12
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/Power.scala43
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ReplVals.scala25
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/RichClass.scala10
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala20
-rw-r--r--src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala6
-rw-r--r--src/compiler/scala/tools/nsc/io/Pickler.scala2
-rw-r--r--src/compiler/scala/tools/nsc/settings/MutableSettings.scala4
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala30
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala2
-rw-r--r--src/compiler/scala/tools/nsc/util/ClassPath.scala12
-rw-r--r--src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala10
-rw-r--r--src/compiler/scala/tools/reflect/Invoked.scala2
-rw-r--r--src/compiler/scala/tools/reflect/UniversalFn.scala4
-rw-r--r--src/compiler/scala/tools/reflect/package.scala23
-rw-r--r--src/detach/library/scala/remoting/Channel.scala32
-rw-r--r--src/library/scala/Array.scala54
-rw-r--r--src/library/scala/collection/GenTraversableOnce.scala6
-rw-r--r--src/library/scala/collection/Traversable.scala2
-rw-r--r--src/library/scala/collection/TraversableOnce.scala2
-rw-r--r--src/library/scala/collection/TraversableProxyLike.scala2
-rw-r--r--src/library/scala/collection/generic/ArrayTagTraversableFactory.scala (renamed from src/library/scala/collection/generic/ClassManifestTraversableFactory.scala)10
-rw-r--r--src/library/scala/collection/generic/GenericArrayTagCompanion.scala (renamed from src/library/scala/collection/generic/GenericClassManifestCompanion.scala)10
-rw-r--r--src/library/scala/collection/generic/GenericArrayTagTraversableTemplate.scala30
-rw-r--r--src/library/scala/collection/generic/GenericClassManifestTraversableTemplate.scala26
-rw-r--r--src/library/scala/collection/generic/TraversableForwarder.scala2
-rw-r--r--src/library/scala/collection/generic/package.scala9
-rw-r--r--src/library/scala/collection/immutable/PagedSeq.scala10
-rw-r--r--src/library/scala/collection/immutable/StringLike.scala2
-rw-r--r--src/library/scala/collection/interfaces/IterableMethods.scala1
-rw-r--r--src/library/scala/collection/interfaces/SeqMethods.scala1
-rw-r--r--src/library/scala/collection/interfaces/SetMethods.scala1
-rw-r--r--src/library/scala/collection/interfaces/TraversableOnceMethods.scala2
-rw-r--r--src/library/scala/collection/mutable/ArrayBuilder.scala17
-rw-r--r--src/library/scala/collection/mutable/ArrayOps.scala27
-rw-r--r--src/library/scala/collection/mutable/ArrayStack.scala2
-rw-r--r--src/library/scala/collection/mutable/FlatArray.scala28
-rw-r--r--src/library/scala/collection/mutable/UnrolledBuffer.scala14
-rw-r--r--src/library/scala/collection/mutable/WrappedArray.scala43
-rw-r--r--src/library/scala/collection/mutable/WrappedArrayBuilder.scala16
-rw-r--r--src/library/scala/collection/parallel/ParIterableLike.scala20
-rw-r--r--src/library/scala/collection/parallel/mutable/ParArray.scala4
-rw-r--r--src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala2
-rw-r--r--src/library/scala/concurrent/Future.scala36
-rw-r--r--src/library/scala/reflect/DummyMirror.scala3
-rwxr-xr-xsrc/library/scala/reflect/api/AnnotationInfos.scala2
-rw-r--r--src/library/scala/util/Marshal.scala2
-rw-r--r--src/library/scala/util/Sorting.scala16
-rw-r--r--src/library/scala/util/control/Exception.scala6
-rw-r--r--src/partest/scala/tools/partest/CompilerTest.scala11
-rw-r--r--src/partest/scala/tools/partest/SigTest.scala24
-rw-r--r--src/scalacheck/org/scalacheck/Arbitrary.scala2
-rw-r--r--src/scalacheck/org/scalacheck/util/Buildable.scala2
-rw-r--r--src/swing/scala/swing/Font.scala.disabled32
-rw-r--r--test/benchmarks/src/scala/collection/parallel/benchmarks/arrays/Resetting.scala8
-rw-r--r--test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/MatrixMultiplication.scala26
-rw-r--r--test/disabled/presentation/akka.check24
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/Actor.scala4
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/ActorRef.scala16
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/ActorRegistry.scala30
-rw-r--r--test/disabled/presentation/akka/src/akka/event/EventHandler.scala4
-rw-r--r--test/disabled/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala4
-rw-r--r--test/disabled/presentation/akka/src/akka/util/Helpers.scala2
-rw-r--r--test/disabled/presentation/simple-tests.check2
-rw-r--r--test/files/jvm/manifests-new.check58
-rw-r--r--test/files/jvm/manifests-new.scala (renamed from test/files/jvm/manifests.scala)21
-rw-r--r--test/files/jvm/manifests.check56
-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.check4
-rw-r--r--test/files/neg/t2386.scala3
-rw-r--r--test/files/neg/t3692-new.check4
-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.check11
-rw-r--r--test/files/neg/t5452-new.check8
-rw-r--r--test/files/neg/t5452-new.scala (renamed from test/files/neg/t5452.scala)4
-rw-r--r--test/files/neg/t5452.check8
-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.scala10
-rw-r--r--test/files/pos/nothing_manifest_disambig.scala10
-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.check2
-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.check64
-rw-r--r--test/files/run/repl-power.scala3
-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.check2
-rw-r--r--test/files/run/t2386-new.scala5
-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.check6
-rw-r--r--test/files/run/t3758.scala10
-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.scala20
-rw-r--r--test/pending/shootout/meteor.scala64
-rw-r--r--test/scaladoc/resources/implicits-base-res.scala3
153 files changed, 833 insertions, 837 deletions
diff --git a/src/compiler/scala/reflect/internal/AnnotationInfos.scala b/src/compiler/scala/reflect/internal/AnnotationInfos.scala
index b86c62661a..fe0175fe72 100644
--- a/src/compiler/scala/reflect/internal/AnnotationInfos.scala
+++ b/src/compiler/scala/reflect/internal/AnnotationInfos.scala
@@ -260,8 +260,7 @@ trait AnnotationInfos extends api.AnnotationInfos { self: SymbolTable =>
}
}
- lazy val classfileAnnotArgManifest: ClassManifest[ClassfileAnnotArg] =
- reflect.ClassManifest[ClassfileAnnotArg](classOf[ClassfileAnnotArg])
+ lazy val classfileAnnotArgTag: ArrayTag[ClassfileAnnotArg] = arrayTag[ClassfileAnnotArg]
object UnmappableAnnotation extends CompleteAnnotationInfo(NoType, Nil, Nil)
}
diff --git a/src/compiler/scala/reflect/internal/Definitions.scala b/src/compiler/scala/reflect/internal/Definitions.scala
index 28905dd240..29eb573b64 100644
--- a/src/compiler/scala/reflect/internal/Definitions.scala
+++ b/src/compiler/scala/reflect/internal/Definitions.scala
@@ -534,9 +534,9 @@ trait Definitions extends reflect.api.StandardDefinitions {
// private lazy val importerFromRm = self.mkImporter(rm)
private lazy val importerFromRm = self.mkImporter(rm).asInstanceOf[self.Importer { val from: rm.type }]
- def manifestToType(m: Manifest[_]): Type = importerFromRm.importType(m.tpe)
+ def compilerTypeFromTag(t: rm.TypeTag[_]): Type = importerFromRm.importType(t.tpe)
- def manifestToSymbol(m: Manifest[_]): Symbol = importerFromRm.importSymbol(m.tpe.typeSymbol)
+ def compilerSymbolFromTag(t: rm.TypeTag[_]): Symbol = importerFromRm.importSymbol(t.sym)
// The given symbol represents either String.+ or StringAdd.+
def isStringAddition(sym: Symbol) = sym == String_+ || sym == StringAdd_+
diff --git a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala
index eb4bae78d0..fd3fac1b37 100644
--- a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala
+++ b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala
@@ -447,7 +447,7 @@ abstract class UnPickler /*extends reflect.generic.UnPickler*/ {
private def readArrayAnnot() = {
readByte() // skip the `annotargarray` tag
val end = readNat() + readIndex
- until(end, () => readClassfileAnnotArg(readNat())).toArray(classfileAnnotArgManifest)
+ until(end, () => readClassfileAnnotArg(readNat())).toArray(classfileAnnotArgTag)
}
protected def readClassfileAnnotArg(i: Int): ClassfileAnnotArg = bytes(index(i)) match {
case ANNOTINFO => NestedAnnotArg(at(i, readAnnotation))
@@ -843,7 +843,7 @@ abstract class UnPickler /*extends reflect.generic.UnPickler*/ {
atPhase(p) (sym setInfo tp)
if (currentRunId != definedAtRunId)
sym.setInfo(adaptToNewRunMap(tp))
- }
+ }
catch {
case e: MissingRequirementError => throw toTypeError(e)
}
diff --git a/src/compiler/scala/reflect/internal/util/Origins.scala b/src/compiler/scala/reflect/internal/util/Origins.scala
index b9985c8f50..19b3adda9d 100644
--- a/src/compiler/scala/reflect/internal/util/Origins.scala
+++ b/src/compiler/scala/reflect/internal/util/Origins.scala
@@ -88,7 +88,7 @@ object Origins {
sys.addShutdownHook(counters foreach (_.purge()))
}
- def apply[T: Manifest](tag: String): Origins = apply(tag, manifest[T].erasure)
+ def apply[T: ClassTag](tag: String): Origins = apply(tag, classTag[T].erasure)
def apply(tag: String, clazz: Class[_]): Origins = apply(tag, new OneLine(clazz))
def apply(tag: String, orElse: => Origins): Origins = {
counters find (_.tag == tag) getOrElse {
diff --git a/src/compiler/scala/reflect/runtime/Mirror.scala b/src/compiler/scala/reflect/runtime/Mirror.scala
index 20024ed058..bf4bc83bea 100644
--- a/src/compiler/scala/reflect/runtime/Mirror.scala
+++ b/src/compiler/scala/reflect/runtime/Mirror.scala
@@ -25,7 +25,7 @@ class Mirror(var classLoader: ClassLoader) extends Universe with api.Mirror {
def symbolOfInstance(obj: Any): Symbol = classToScala(obj.getClass)
def typeOfInstance(obj: Any): Type = typeToScala(obj.getClass)
// to do add getClass/getType for instances of primitive types, probably like this:
- // def getClass[T <: AnyVal : Manifest](x: T): Symbol = manifest[T].getClass
+ // def getClass[T <: AnyVal : ClassTag](x: T): Symbol = classTag[T].sym
def getValueOfField(receiver: AnyRef, field: Symbol): Any = {
fieldToJava(field).get(receiver)
diff --git a/src/compiler/scala/tools/cmd/FromString.scala b/src/compiler/scala/tools/cmd/FromString.scala
index 9592e7a716..91356b3c19 100644
--- a/src/compiler/scala/tools/cmd/FromString.scala
+++ b/src/compiler/scala/tools/cmd/FromString.scala
@@ -7,19 +7,19 @@ package scala.tools
package cmd
import nsc.io.{ Path, File, Directory }
-import scala.reflect.Manifest
+import scala.reflect.TypeTag
/** A general mechanism for defining how a command line argument
* (always a String) is transformed into an arbitrary type. A few
* example instances are in the companion object, but in general
* either IntFromString will suffice or you'll want custom transformers.
*/
-abstract class FromString[+T](implicit m: Manifest[T]) extends PartialFunction[String, T] {
+abstract class FromString[+T](implicit t: TypeTag[T]) extends PartialFunction[String, T] {
def apply(s: String): T
def isDefinedAt(s: String): Boolean = true
def zero: T = apply("")
- def targetString: String = m.toString
+ def targetString: String = t.toString
}
object FromString {
diff --git a/src/compiler/scala/tools/nsc/Phases.scala b/src/compiler/scala/tools/nsc/Phases.scala
index 1fa576afb6..aa0ea1bdd8 100644
--- a/src/compiler/scala/tools/nsc/Phases.scala
+++ b/src/compiler/scala/tools/nsc/Phases.scala
@@ -14,7 +14,7 @@ object Phases {
/** A class for tracking something about each phase.
*/
- class Model[T: Manifest] {
+ class Model[T] {
case class Cell(ph: Phase, value: T) {
def name = ph.name
def id = ph.id
diff --git a/src/compiler/scala/tools/nsc/doc/Settings.scala b/src/compiler/scala/tools/nsc/doc/Settings.scala
index 17bfb7d21d..d3a1d47de8 100644
--- a/src/compiler/scala/tools/nsc/doc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/doc/Settings.scala
@@ -150,12 +150,15 @@ class Settings(error: String => Unit) extends scala.tools.nsc.Settings(error) {
* the function result should be a humanly-understandable description of the type class
*/
val knownTypeClasses: Map[String, String => String] = Map() +
- ("<root>.scala.package.Numeric" -> ((tparam: String) => tparam + " is a numeric class, such as Int, Long, Float or Double")) +
- ("<root>.scala.package.Integral" -> ((tparam: String) => tparam + " is an integral numeric class, such as Int or Long")) +
- ("<root>.scala.package.Fractional" -> ((tparam: String) => tparam + " is a fractional numeric class, such as Float or Double")) +
- ("<root>.scala.reflect.Manifest" -> ((tparam: String) => tparam + " is accompanied by a Manifest, which is a runtime representation of its type that survives erasure")) +
- ("<root>.scala.reflect.ClassManifest" -> ((tparam: String) => tparam + " is accompanied by a ClassManifest, which is a runtime representation of its type that survives erasure")) +
- ("<root>.scala.reflect.OptManifest" -> ((tparam: String) => tparam + " is accompanied by an OptManifest, which can be either a runtime representation of its type or the NoManifest, which means the runtime type is not available"))
+ ("<root>.scala.package.Numeric" -> ((tparam: String) => tparam + " is a numeric class, such as Int, Long, Float or Double")) +
+ ("<root>.scala.package.Integral" -> ((tparam: String) => tparam + " is an integral numeric class, such as Int or Long")) +
+ ("<root>.scala.package.Fractional" -> ((tparam: String) => tparam + " is a fractional numeric class, such as Float or Double")) +
+ ("<root>.scala.reflect.Manifest" -> ((tparam: String) => tparam + " is accompanied by a Manifest, which is a runtime representation of its type that survives erasure")) +
+ ("<root>.scala.reflect.ClassManifest" -> ((tparam: String) => tparam + " is accompanied by a ClassManifest, which is a runtime representation of its type that survives erasure")) +
+ ("<root>.scala.reflect.OptManifest" -> ((tparam: String) => tparam + " is accompanied by an OptManifest, which can be either a runtime representation of its type or the NoManifest, which means the runtime type is not available")) +
+ ("<root>.scala.reflect.ClassTag" -> ((tparam: String) => tparam + " is accompanied by a ClassTag, which is a runtime representation of its type that survives erasure")) +
+ ("<root>.scala.reflect.TypeTag" -> ((tparam: String) => tparam + " is accompanied by a TypeTag, which is a runtime representation of its type that survives erasure")) +
+ ("<root>.scala.reflect.ConcreteTypeTag" -> ((tparam: String) => tparam + " is accompanied by an ConcreteTypeTag, which is a runtime representation of a concrete type that survives erasure"))
/**
* Set of classes to exclude from index and diagrams
diff --git a/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala b/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala
index f67abc58da..3ff973ec66 100644
--- a/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala
@@ -41,13 +41,13 @@ private[html] object SyntaxHigh {
/** Standard library classes/objects, sorted alphabetically */
val standards = Array (
"Any", "AnyRef", "AnyVal", "App", "Application", "Array",
- "Boolean", "Byte", "Char", "Class", "Console", "Double",
- "Enumeration", "Float", "Function", "Int",
+ "Boolean", "Byte", "Char", "Class", "ClassTag", "ClassManifest", "ConcreteTypeTag",
+ "Console", "Double", "Enumeration", "Float", "Function", "Int",
"List", "Long", "Manifest", "Map",
- "None", "Nothing", "Null", "Object", "Option",
+ "NoManifest", "None", "Nothing", "Null", "Object", "Option", "OptManifest",
"Pair", "Predef",
"Seq", "Set", "Short", "Some", "String", "Symbol",
- "Triple", "Unit")
+ "Triple", "TypeTag", "Unit")
def apply(data: String): NodeSeq = {
val buf = data.getBytes
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala
index 4e03dc8788..61f3670f5f 100644
--- a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala
@@ -137,7 +137,7 @@ trait ModelFactoryImplicitSupport {
// Members inherited by implicit conversions cannot override actual members
memberSyms = memberSyms.filterNot((sym1: Symbol) =>
- existingMembers.exists(sym2 => sym1.name == sym2.name &&
+ existingMembers.exists(sym2 => sym1.name == sym2.name &&
!isDistinguishableFrom(toType.memberInfo(sym1), sym.info.memberInfo(sym2))))
debug(" -> full type: " + toType)
@@ -199,12 +199,12 @@ trait ModelFactoryImplicitSupport {
* What? in details:
* - say we start from a class A[T1, T2, T3, T4]
* - we have an implicit function (view) in scope:
- * def pimpA[T3 <: Long, T4](a: A[Int, Foo[Bar[X]], T3, T4])(implicit ev1: Manifest[T4], ev2: Numeric[T4]): PimpedA
+ * def pimpA[T3 <: Long, T4](a: A[Int, Foo[Bar[X]], T3, T4])(implicit ev1: TypeTag[T4], ev2: Numeric[T4]): PimpedA
* - A is converted to PimpedA ONLY if a couple of constraints are satisfied:
* * T1 must be equal to Int
* * T2 must be equal to Foo[Bar[X]]
* * T3 must be upper bounded by Long
- * * there must be evidence of Numeric[T4] and a Mainfest[T4] within scope
+ * * there must be evidence of Numeric[T4] and a TypeTag[T4] within scope
* - the final type is PimpedA and A therefore inherits a couple of members from pimpedA
*
* How?
@@ -504,14 +504,14 @@ trait ModelFactoryImplicitSupport {
* class. We suppose the name of the two members coincides
*
* The trick here is that the resultType does not matter - the condition for removal it that paramss have the same
- * structure (A => B => C may not override (A, B) => C) and that all the types involved are
+ * structure (A => B => C may not override (A, B) => C) and that all the types involved are
* of the implcit conversion's member are subtypes of the parent members' parameters */
- def isDistinguishableFrom(t1: Type, t2: Type): Boolean =
+ def isDistinguishableFrom(t1: Type, t2: Type): Boolean =
if (t1.paramss.map(_.length) == t2.paramss.map(_.length)) {
for ((t1p, t2p) <- t1.paramss.flatten zip t2.paramss.flatten)
if (!isSubType(t1 memberInfo t1p, t2 memberInfo t2p))
- return true // if on the corresponding parameter you give a type that is in t1 but not in t2
- // example:
+ return true // if on the corresponding parameter you give a type that is in t1 but not in t2
+ // example:
// def foo(a: Either[Int, Double]): Int = 3
// def foo(b: Left[T1]): Int = 6
// a.foo(Right(4.5d)) prints out 3 :)
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
index 9279d37464..297d6ad1b9 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
@@ -1053,11 +1053,11 @@ object ILoop {
// provide the enclosing type T
// in order to set up the interpreter's classpath and parent class loader properly
- def breakIf[T: Manifest](assertion: => Boolean, args: NamedParam*): Unit =
+ def breakIf[T: ClassTag](assertion: => Boolean, args: NamedParam*): Unit =
if (assertion) break[T](args.toList)
// start a repl, binding supplied args
- def break[T: Manifest](args: List[NamedParam]): Unit = savingContextLoader {
+ def break[T: ClassTag](args: List[NamedParam]): Unit = savingContextLoader {
val msg = if (args.isEmpty) "" else " Binding " + args.size + " value%s.".format(
if (args.size == 1) "" else "s"
)
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala b/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala
index 2f02748e8f..6a9654732b 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala
@@ -100,7 +100,7 @@ trait ILoopInit {
withLock { while (!initIsComplete) initLoopCondition.await() }
}
// private def warningsThunks = List(
- // () => intp.bind("lastWarnings", "" + manifest[List[(Position, String)]], intp.lastWarnings _),
+ // () => intp.bind("lastWarnings", "" + typeTag[List[(Position, String)]], intp.lastWarnings _),
// )
protected def postInitThunks = List[Option[() => Unit]](
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
index 923fc867a9..3d77344091 100644
--- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
@@ -351,7 +351,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends
classLoader.setAsContext()
// this is risky, but it's our only possibility to make default reflexive mirror to work with REPL
- // so far we have only used the default mirror to create a few manifests for the compiler
+ // so far we have only used the default mirror to create a few tags for the compiler
// so it shouldn't be in conflict with our classloader, especially since it respects its parent
scala.reflect.mirror.classLoader = classLoader
}
@@ -667,7 +667,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends
result
}
def directBind(p: NamedParam): IR.Result = directBind(p.name, p.tpe, p.value)
- def directBind[T: Manifest](name: String, value: T): IR.Result = directBind((name, value))
+ def directBind[T: ClassTag](name: String, value: T): IR.Result = directBind((name, value))
def rebind(p: NamedParam): IR.Result = {
val name = p.name
@@ -683,12 +683,12 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends
if (ids.isEmpty) IR.Success
else interpret("import " + ids.mkString(", "))
- def quietBind(p: NamedParam): IR.Result = beQuietDuring(bind(p))
- def bind(p: NamedParam): IR.Result = bind(p.name, p.tpe, p.value)
- def bind[T: Manifest](name: String, value: T): IR.Result = bind((name, value))
- def bindSyntheticValue(x: Any): IR.Result = bindValue(freshInternalVarName(), x)
- def bindValue(x: Any): IR.Result = bindValue(freshUserVarName(), x)
- def bindValue(name: String, x: Any): IR.Result = bind(name, TypeStrings.fromValue(x), x)
+ def quietBind(p: NamedParam): IR.Result = beQuietDuring(bind(p))
+ def bind(p: NamedParam): IR.Result = bind(p.name, p.tpe, p.value)
+ def bind[T: TypeTag](name: String, value: T): IR.Result = bind((name, value))
+ def bindSyntheticValue(x: Any): IR.Result = bindValue(freshInternalVarName(), x)
+ def bindValue(x: Any): IR.Result = bindValue(freshUserVarName(), x)
+ def bindValue(name: String, x: Any): IR.Result = bind(name, TypeStrings.fromValue(x), x)
/** Reset this interpreter, forgetting all user-specified requests. */
def reset() {
@@ -1185,9 +1185,10 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends
val termname = newTypeName(name)
findName(termname) orElse getModuleIfDefined(termname)
}
- def types[T: ClassManifest] : Symbol = types(classManifest[T].erasure.getName)
- def terms[T: ClassManifest] : Symbol = terms(classManifest[T].erasure.getName)
- def apply[T: ClassManifest] : Symbol = apply(classManifest[T].erasure.getName)
+ // [Eugene to Paul] possibly you could make use of TypeTags here
+ def types[T: ClassTag] : Symbol = types(classTag[T].erasure.getName)
+ def terms[T: ClassTag] : Symbol = terms(classTag[T].erasure.getName)
+ def apply[T: ClassTag] : Symbol = apply(classTag[T].erasure.getName)
def classSymbols = allDefSymbols collect { case x: ClassSymbol => x }
def methodSymbols = allDefSymbols collect { case x: MethodSymbol => x }
diff --git a/src/compiler/scala/tools/nsc/interpreter/NamedParam.scala b/src/compiler/scala/tools/nsc/interpreter/NamedParam.scala
index e2b1bf34d6..a3cbfffc3b 100644
--- a/src/compiler/scala/tools/nsc/interpreter/NamedParam.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/NamedParam.scala
@@ -13,19 +13,19 @@ trait NamedParamCreator {
protected def freshName: () => String
def apply(name: String, tpe: String, value: Any): NamedParam = NamedParamClass(name, tpe, value)
- def apply[T: Manifest](name: String, x: T): NamedParam = new Typed[T](name, x)
- def apply[T: Manifest](x: T): NamedParam = apply(freshName(), x)
+ def apply[T: TypeTag](name: String, x: T): NamedParam = new Typed[T](name, x)
+ def apply[T: TypeTag](x: T): NamedParam = apply(freshName(), x)
def clazz(name: String, x: Any): NamedParam = new Untyped(name, x)
def clazz(x: Any): NamedParam = clazz(freshName(), x)
- implicit def namedValue[T: Manifest](name: String, x: T): NamedParam = apply(name, x)
- implicit def tuple[T: Manifest](pair: (String, T)): NamedParam = apply(pair._1, pair._2)
+ implicit def namedValue[T: TypeTag](name: String, x: T): NamedParam = apply(name, x)
+ implicit def tuple[T: TypeTag](pair: (String, T)): NamedParam = apply(pair._1, pair._2)
}
object NamedParam extends NamedParamCreator {
- class Typed[T: Manifest](val name: String, val value: T) extends NamedParam {
- val tpe = TypeStrings.fromManifest[T]
+ class Typed[T: TypeTag](val name: String, val value: T) extends NamedParam {
+ val tpe = TypeStrings.fromTag[T]
}
class Untyped(val name: String, val value: Any) extends NamedParam {
val tpe = TypeStrings.fromValue(value)
diff --git a/src/compiler/scala/tools/nsc/interpreter/Power.scala b/src/compiler/scala/tools/nsc/interpreter/Power.scala
index 2cb034f7ab..01ace0e984 100644
--- a/src/compiler/scala/tools/nsc/interpreter/Power.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/Power.scala
@@ -42,10 +42,10 @@ Lost after 18/flatten {
/** A class for methods to be injected into the intp in power mode.
*/
-class Power[ReplValsImpl <: ReplVals : Manifest](val intp: IMain, replVals: ReplValsImpl) {
+class Power[ReplValsImpl <: ReplVals : TypeTag](val intp: IMain, replVals: ReplValsImpl) {
import intp.{ beQuietDuring, typeOfExpression, interpret, parse }
import intp.global._
- import definitions.{ manifestToType, manifestToSymbol, getClassIfDefined, getModuleIfDefined }
+ import definitions.{ compilerTypeFromTag, compilerSymbolFromTag, getClassIfDefined, getModuleIfDefined }
abstract class SymSlurper {
def isKeep(sym: Symbol): Boolean
@@ -162,7 +162,7 @@ class Power[ReplValsImpl <: ReplVals : Manifest](val intp: IMain, replVals: Repl
}
trait LowPriorityInternalInfo {
- implicit def apply[T: Manifest] : InternalInfo[T] = new InternalInfo[T](None)
+ implicit def apply[T: TypeTag] : InternalInfo[T] = new InternalInfo[T](None)
}
object InternalInfo extends LowPriorityInternalInfo { }
@@ -173,21 +173,21 @@ class Power[ReplValsImpl <: ReplVals : Manifest](val intp: IMain, replVals: Repl
* of the conveniences exist on that wrapper.
*/
trait LowPriorityInternalInfoWrapper {
- implicit def apply[T: Manifest] : InternalInfoWrapper[T] = new InternalInfoWrapper[T](None)
+ implicit def apply[T: TypeTag] : InternalInfoWrapper[T] = new InternalInfoWrapper[T](None)
}
object InternalInfoWrapper extends LowPriorityInternalInfoWrapper {
}
- class InternalInfoWrapper[T: Manifest](value: Option[T] = None) {
+ class InternalInfoWrapper[T: TypeTag](value: Option[T] = None) {
def ? : InternalInfo[T] = new InternalInfo[T](value)
}
/** Todos...
- * translate manifest type arguments into applied types
+ * translate tag type arguments into applied types
* customizable symbol filter (had to hardcode no-spec to reduce noise)
*/
- class InternalInfo[T: Manifest](value: Option[T] = None) {
- private def newInfo[U: Manifest](value: U): InternalInfo[U] = new InternalInfo[U](Some(value))
+ class InternalInfo[T: TypeTag](value: Option[T] = None) {
+ private def newInfo[U: TypeTag](value: U): InternalInfo[U] = new InternalInfo[U](Some(value))
private def isSpecialized(s: Symbol) = s.name.toString contains "$mc"
private def isImplClass(s: Symbol) = s.name.toString endsWith "$class"
@@ -198,8 +198,8 @@ class Power[ReplValsImpl <: ReplVals : Manifest](val intp: IMain, replVals: Repl
|| s.isAnonOrRefinementClass
|| s.isAnonymousFunction
)
- def symbol = manifestToSymbol(fullManifest)
- def tpe = manifestToType(fullManifest)
+ def symbol = compilerSymbolFromTag(tag)
+ def tpe = compilerTypeFromTag(tag)
def name = symbol.name
def companion = symbol.companionSymbol
def info = symbol.info
@@ -226,8 +226,8 @@ class Power[ReplValsImpl <: ReplVals : Manifest](val intp: IMain, replVals: Repl
def pkgClasses = pkgMembers filter (s => s.isClass && s.isDefinedInPackage)
def pkgSymbols = new PackageSlurper(pkgClass).slurp() filterNot excludeMember
- def fullManifest = manifest[T]
- def erasure = fullManifest.erasure
+ def tag = typeTag[T]
+ def erasure = tag.erasure
def shortClass = erasure.getName split "[$.]" last
def baseClasses = tpe.baseClasses
@@ -236,9 +236,9 @@ class Power[ReplValsImpl <: ReplVals : Manifest](val intp: IMain, replVals: Repl
def ancestorDeclares(name: String) = ancestors filter (_.info member newTermName(name) ne NoSymbol)
def baseTypes = tpe.baseTypeSeq.toList
- def <:<[U: Manifest](other: U) = tpe <:< newInfo(other).tpe
- def lub[U: Manifest](other: U) = intp.global.lub(List(tpe, newInfo(other).tpe))
- def glb[U: Manifest](other: U) = intp.global.glb(List(tpe, newInfo(other).tpe))
+ def <:<[U: TypeTag](other: U) = tpe <:< newInfo(other).tpe
+ def lub[U: TypeTag](other: U) = intp.global.lub(List(tpe, newInfo(other).tpe))
+ def glb[U: TypeTag](other: U) = intp.global.glb(List(tpe, newInfo(other).tpe))
override def toString = value match {
case Some(x) => "%s (%s)".format(x, shortClass)
@@ -366,7 +366,7 @@ class Power[ReplValsImpl <: ReplVals : Manifest](val intp: IMain, replVals: Repl
implicit lazy val powerSymbolOrdering: Ordering[Symbol] = Ordering[Name] on (_.name)
implicit lazy val powerTypeOrdering: Ordering[Type] = Ordering[Symbol] on (_.typeSymbol)
- implicit def replInternalInfo[T: Manifest](x: T): InternalInfoWrapper[T] = new InternalInfoWrapper[T](Some(x))
+ implicit def replInternalInfo[T: TypeTag](x: T): InternalInfoWrapper[T] = new InternalInfoWrapper[T](Some(x))
implicit def replEnhancedStrings(s: String): RichReplString = new RichReplString(s)
implicit def replMultiPrinting[T: Prettifier](xs: TraversableOnce[T]): MultiPrettifierClass[T] =
new MultiPrettifierClass[T](xs.toSeq)
@@ -381,10 +381,13 @@ class Power[ReplValsImpl <: ReplVals : Manifest](val intp: IMain, replVals: Repl
}
trait ReplUtilities {
- def module[T: Manifest] = getModuleIfDefined(manifest[T].erasure.getName stripSuffix nme.MODULE_SUFFIX_STRING)
- def clazz[T: Manifest] = getClassIfDefined(manifest[T].erasure.getName)
- def info[T: Manifest] = InternalInfo[T]
- def ?[T: Manifest] = InternalInfo[T]
+ // [Eugene to Paul] needs review!
+ // def module[T: TypeTag] = getModuleIfDefined(typeTag[T].erasure.getName stripSuffix nme.MODULE_SUFFIX_STRING)
+ // def clazz[T: TypeTag] = getClassIfDefined(typeTag[T].erasure.getName)
+ def module[T: TypeTag] = typeTag[T].sym.suchThat(_.isPackage)
+ def clazz[T: TypeTag] = typeTag[T].sym.suchThat(_.isClass)
+ def info[T: TypeTag] = InternalInfo[T]
+ def ?[T: TypeTag] = InternalInfo[T]
def url(s: String) = {
try new URL(s)
catch { case _: MalformedURLException =>
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala b/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala
index 4efab7e260..280247f20c 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala
@@ -6,6 +6,7 @@
package scala.tools.nsc
package interpreter
+import scala.reflect.{mirror => rm}
import language.implicitConversions
/** A class which the repl utilizes to expose predefined objects.
@@ -39,8 +40,8 @@ class StdReplVals(final val r: ILoop) extends ReplVals {
class ReplImplicits extends power.Implicits2 {
import intp.global._
- private val manifestFn = ReplVals.mkManifestToType[intp.global.type](global)
- implicit def mkManifestToType(sym: Symbol) = manifestFn(sym)
+ private val tagFn = ReplVals.mkCompilerTypeFromTag[intp.global.type](global)
+ implicit def mkCompilerTypeFromTag(sym: Symbol) = tagFn(sym)
}
final lazy val replImplicits = new ReplImplicits
@@ -53,29 +54,29 @@ object ReplVals {
* not being seen as the same type as bar.global.Type even though
* the globals are the same. Dependent method types to the rescue.
*/
- def mkManifestToType[T <: Global](global: T) = {
+ def mkCompilerTypeFromTag[T <: Global](global: T) = {
import global._
import definitions._
- /** We can't use definitions.manifestToType directly because we're passing
+ /** We can't use definitions.compilerTypeFromTag directly because we're passing
* it to map and the compiler refuses to perform eta expansion on a method
* with a dependent return type. (Can this be relaxed?) To get around this
* I have this forwarder which widens the type and then cast the result back
* to the dependent type.
*/
- def manifestToType(m: Manifest[_]): Global#Type =
- definitions.manifestToType(m)
+ def compilerTypeFromTag(t: rm.TypeTag[_]): Global#Type =
+ definitions.compilerTypeFromTag(t)
- class AppliedTypeFromManifests(sym: Symbol) {
- def apply[M](implicit m1: Manifest[M]): Type =
+ class AppliedTypeFromTags(sym: Symbol) {
+ def apply[M](implicit m1: rm.TypeTag[M]): Type =
if (sym eq NoSymbol) NoType
- else appliedType(sym, manifestToType(m1).asInstanceOf[Type])
+ else appliedType(sym, compilerTypeFromTag(m1).asInstanceOf[Type])
- def apply[M1, M2](implicit m1: Manifest[M1], m2: Manifest[M2]): Type =
+ def apply[M1, M2](implicit m1: rm.TypeTag[M1], m2: rm.TypeTag[M2]): Type =
if (sym eq NoSymbol) NoType
- else appliedType(sym, manifestToType(m1).asInstanceOf[Type], manifestToType(m2).asInstanceOf[Type])
+ else appliedType(sym, compilerTypeFromTag(m1).asInstanceOf[Type], compilerTypeFromTag(m2).asInstanceOf[Type])
}
- (sym: Symbol) => new AppliedTypeFromManifests(sym)
+ (sym: Symbol) => new AppliedTypeFromTags(sym)
}
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/RichClass.scala b/src/compiler/scala/tools/nsc/interpreter/RichClass.scala
index 3d4d22063e..2e735e3b9b 100644
--- a/src/compiler/scala/tools/nsc/interpreter/RichClass.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/RichClass.scala
@@ -6,10 +6,8 @@
package scala.tools.nsc
package interpreter
-import scala.reflect.{mirror => rm}
-
class RichClass[T](val clazz: Class[T]) {
- def toManifest: Manifest[T] = Manifest[T](rm.classToType(clazz))
+ def toTag: ClassTag[T] = ClassTag[T](clazz)
def toTypeString: String = TypeStrings.fromClazz(clazz)
// Sadly isAnonymousClass does not return true for scala anonymous
@@ -21,9 +19,9 @@ class RichClass[T](val clazz: Class[T]) {
)
/** It's not easy... to be... me... */
- def supermans: List[Manifest[_]] = supers map (_.toManifest)
- def superNames: List[String] = supers map (_.getName)
- def interfaces: List[JClass] = supers filter (_.isInterface)
+ def supermans: List[ClassTag[_]] = supers map (_.toTag)
+ def superNames: List[String] = supers map (_.getName)
+ def interfaces: List[JClass] = supers filter (_.isInterface)
def hasAncestorName(f: String => Boolean) = superNames exists f
def hasAncestor(f: JClass => Boolean) = supers exists f
diff --git a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala
index 9ba75d9166..5d5123811e 100644
--- a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala
@@ -192,8 +192,8 @@ trait TypeStrings {
else enclClass.getName + "." + (name stripPrefix enclPre)
)
}
- def scalaName(m: ClassManifest[_]): String = scalaName(m.erasure)
- def anyClass(x: Any): JClass = if (x == null) null else x.getClass
+ def scalaName(m: ClassTag[_]): String = scalaName(m.erasure)
+ def anyClass(x: Any): JClass = if (x == null) null else x.getClass
private def brackets(tps: String*): String =
if (tps.isEmpty) ""
@@ -209,25 +209,25 @@ trait TypeStrings {
brackets(clazz.getTypeParameters map tvarString: _*)
}
- private def tparamString[T: Manifest] : String = {
+ private def tparamString[T: TypeTag] : String = {
// [Eugene to Paul] needs review!!
- def typeArguments: List[rm.Type] = manifest[T].tpe.typeArguments
+ def typeArguments: List[rm.Type] = typeTag[T].tpe.typeArguments
def typeVariables: List[java.lang.Class[_]] = typeArguments map (targ => rm.typeToClass(targ))
brackets(typeArguments map (jc => tvarString(List(jc))): _*)
}
/** Going for an overabundance of caution right now. Later these types
- * can be a lot more precise, but right now the manifests have a habit of
+ * can be a lot more precise, but right now the tags have a habit of
* introducing material which is not syntactically valid as scala source.
* When this happens it breaks the repl. It would be nice if we mandated
- * that manifest toString methods (or some other method, since it's bad
+ * that tag toString methods (or some other method, since it's bad
* practice to rely on toString for correctness) generated the VALID string
* representation of the type.
*/
- def fromTypedValue[T: Manifest](x: T): String = fromManifest[T]
- def fromValue(value: Any): String = if (value == null) "Null" else fromClazz(anyClass(value))
- def fromClazz(clazz: JClass): String = scalaName(clazz) + tparamString(clazz)
- def fromManifest[T: Manifest] : String = scalaName(manifest[T].erasure) + tparamString[T]
+ def fromTypedValue[T: TypeTag](x: T): String = fromTag[T]
+ def fromValue(value: Any): String = if (value == null) "Null" else fromClazz(anyClass(value))
+ def fromClazz(clazz: JClass): String = scalaName(clazz) + tparamString(clazz)
+ def fromTag[T: TypeTag] : String = scalaName(typeTag[T].erasure) + tparamString[T]
/** Reducing fully qualified noise for some common packages.
*/
diff --git a/src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala b/src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala
index d0a0b17494..c9ed535841 100644
--- a/src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala
+++ b/src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala
@@ -13,9 +13,9 @@ import collection.JavaConverters._
/** A convenience class for finding the jar with the bytecode for
* a given Class object and similar common tasks.
*/
-class ClassAndJarInfo[T: ClassManifest] {
- val man = classManifest[T]
- def clazz = man.erasure
+class ClassAndJarInfo[T: ClassTag] {
+ val tag = classTag[T]
+ def clazz = tag.erasure
def internalName = clazz.getName.replace('.', '/')
def resourceURL = new URLClassLoader(Array[URL]()) getResource internalName + ".class"
diff --git a/src/compiler/scala/tools/nsc/io/Pickler.scala b/src/compiler/scala/tools/nsc/io/Pickler.scala
index 86c7ca7b9a..416b84eec6 100644
--- a/src/compiler/scala/tools/nsc/io/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/io/Pickler.scala
@@ -416,7 +416,7 @@ object Pickler {
iterPickler[T] .wrapped { Vector() ++ _ } { _.iterator } .labelled ("scala.Vector")
/** A pickler for array values */
- implicit def array[T : ClassManifest : Pickler]: Pickler[Array[T]] =
+ implicit def array[T : ClassTag : Pickler]: Pickler[Array[T]] =
iterPickler[T] .wrapped { _.toArray} { _.iterator } .labelled ("scala.Array")
}
diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
index a52e3b8bbe..c4dd9a2a36 100644
--- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
@@ -183,8 +183,8 @@ class MutableSettings(val errorFn: String => Unit)
* The class loader defining `T` should provide resources `app.class.path`
* and `boot.class.path`. These resources should contain the application
* and boot classpaths in the same form as would be passed on the command line.*/
- def embeddedDefaults[T: Manifest]: Unit =
- embeddedDefaults(implicitly[Manifest[T]].erasure.getClassLoader)
+ def embeddedDefaults[T: ClassTag]: Unit =
+ embeddedDefaults(classTag[T].erasure.getClassLoader)
/** Initializes these settings for embedded use by a class from the given class loader.
* The class loader for `T` should provide resources `app.class.path`
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index fd15d92e37..bf01e142c9 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -611,7 +611,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
val ntree = typedWithPos(tree.pos)(safeREF(staticFieldSym))
super.transform(ntree)
- // This transform replaces Array(Predef.wrapArray(Array(...)), <manifest>)
+ // This transform replaces Array(Predef.wrapArray(Array(...)), <tag>)
// with just Array(...)
case Apply(appMeth, List(Apply(wrapRefArrayMeth, List(array)), _))
if (wrapRefArrayMeth.symbol == Predef_wrapRefArray &&
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index c766b52159..338c39dc5f 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -668,6 +668,7 @@ abstract class Erasure extends AddInterfaces
*/
private def adaptMember(tree: Tree): Tree = {
//Console.println("adaptMember: " + tree);
+ val x = 2 + 2
tree match {
case Apply(TypeApply(sel @ Select(qual, name), List(targ)), List())
if tree.symbol == Any_asInstanceOf =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index 8d26f66370..c13be0e39d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -861,7 +861,7 @@ trait ContextErrors {
// (note that this is not a compilation error, it's an artifact of implicit search algorithm)
// normally, such "errors" are discarded by `isCyclicOrErroneous` in Implicits.scala
// but in our case this won't work, because isCyclicOrErroneous catches CyclicReference exceptions
- // while our error will manifest itself as a "recursive method needs a return type"
+ // while our error will present itself as a "recursive method needs a return type"
//
// hence we (together with reportTypeError in TypeDiagnostics) make sure that this CyclicReference
// evades all the handlers on its way and successfully reaches `isCyclicOrErroneous` in Implicits
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
index 9e06cbe0d3..4c71772929 100644
--- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
@@ -8,6 +8,7 @@ package typechecker
import symtab.Flags._
import scala.collection.{ mutable, immutable }
import scala.tools.util.StringOps.{ ojoin }
+import scala.reflect.{ mirror => rm }
import language.higherKinds
/** Logic related to method synthesis which involves cooperation between
@@ -21,50 +22,51 @@ trait MethodSynthesis {
import CODE._
object synthesisUtil {
- type M[T] = Manifest[T]
- type CM[T] = ClassManifest[T]
+ type CTT[T] = rm.ConcreteTypeTag[T]
+ type CT[T] = ClassTag[T]
def ValOrDefDef(sym: Symbol, body: Tree) =
if (sym.isLazy) ValDef(sym, body)
else DefDef(sym, body)
- def applyTypeInternal(manifests: List[M[_]]): Type = {
+ def applyTypeInternal(tags: List[CTT[_]]): Type = {
// [Eugene to Paul] needs review!!
- val symbols = manifests map manifestToSymbol
+ val symbols = tags map compilerSymbolFromTag
val container :: args = symbols
val tparams = container.typeConstructor.typeParams
// Conservative at present - if manifests were more usable this could do a lot more.
- require(symbols forall (_ ne NoSymbol), "Must find all manifests: " + symbols)
+ // [Eugene to Paul] all right, they are now. what do you have in mind?
+ require(symbols forall (_ ne NoSymbol), "Must find all tags: " + symbols)
require(container.owner.isPackageClass, "Container must be a top-level class in a package: " + container)
require(tparams.size == args.size, "Arguments must match type constructor arity: " + tparams + ", " + args)
appliedType(container, args map (_.tpe): _*)
}
- def companionType[T](implicit m: M[T]) =
+ def companionType[T](implicit m: CTT[T]) =
getRequiredModule(m.erasure.getName).tpe
// Use these like `applyType[List, Int]` or `applyType[Map, Int, String]`
- def applyType[CC](implicit m1: M[CC]): Type =
+ def applyType[CC](implicit m1: CTT[CC]): Type =
applyTypeInternal(List(m1))
- def applyType[CC[X1], X1](implicit m1: M[CC[_]], m2: M[X1]): Type =
+ def applyType[CC[X1], X1](implicit m1: CTT[CC[_]], m2: CTT[X1]): Type =
applyTypeInternal(List(m1, m2))
- def applyType[CC[X1, X2], X1, X2](implicit m1: M[CC[_,_]], m2: M[X1], m3: M[X2]): Type =
+ def applyType[CC[X1, X2], X1, X2](implicit m1: CTT[CC[_,_]], m2: CTT[X1], m3: CTT[X2]): Type =
applyTypeInternal(List(m1, m2, m3))
- def applyType[CC[X1, X2, X3], X1, X2, X3](implicit m1: M[CC[_,_,_]], m2: M[X1], m3: M[X2], m4: M[X3]): Type =
+ def applyType[CC[X1, X2, X3], X1, X2, X3](implicit m1: CTT[CC[_,_,_]], m2: CTT[X1], m3: CTT[X2], m4: CTT[X3]): Type =
applyTypeInternal(List(m1, m2, m3, m4))
- def newMethodType[F](owner: Symbol)(implicit m: Manifest[F]): Type = {
- val fnSymbol = manifestToSymbol(m)
- assert(fnSymbol isSubClass FunctionClass(m.tpe.typeArguments.size - 1), (owner, m))
+ def newMethodType[F](owner: Symbol)(implicit t: CTT[F]): Type = {
+ val fnSymbol = compilerSymbolFromTag(t)
+ assert(fnSymbol isSubClass FunctionClass(t.tpe.typeArguments.size - 1), (owner, t))
// [Eugene to Paul] needs review!!
// val symbols = m.typeArguments map (m => manifestToSymbol(m))
// val formals = symbols.init map (_.typeConstructor)
- val formals = manifestToType(m).typeArguments
+ val formals = compilerTypeFromTag(t).typeArguments
val params = owner newSyntheticValueParams formals
MethodType(params, formals.last)
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
index be269cf4b2..3d9fc67389 100644
--- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
@@ -39,14 +39,14 @@ trait NamesDefaults { self: Analyzer =>
def isNamed(arg: Tree) = nameOf(arg).isDefined
/** @param pos maps indices from old to new */
- def reorderArgs[T: ClassManifest](args: List[T], pos: Int => Int): List[T] = {
+ def reorderArgs[T: ArrayTag](args: List[T], pos: Int => Int): List[T] = {
val res = new Array[T](args.length)
foreachWithIndex(args)((arg, index) => res(pos(index)) = arg)
res.toList
}
/** @param pos maps indices from new to old (!) */
- def reorderArgsInv[T: ClassManifest](args: List[T], pos: Int => Int): List[T] = {
+ def reorderArgsInv[T: ArrayTag](args: List[T], pos: Int => Int): List[T] = {
val argsArray = args.toArray
(argsArray.indices map (i => argsArray(pos(i)))).toList
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 868c236ee9..31d064c824 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -74,7 +74,7 @@ trait SyntheticMethods extends ast.TreeDSL {
// Option[Int] { def productIterator: Iterator[String] }
//
// appearing legitimately, but this breaks invariant places
- // like Manifests and Arrays which are not robust and infer things
+ // like Tags and Arrays which are not robust and infer things
// which they shouldn't.
val accessorLub = (
if (opt.experimental) {
diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala
index 5dd9ce0e02..48ec941b50 100644
--- a/src/compiler/scala/tools/nsc/util/ClassPath.scala
+++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala
@@ -26,12 +26,12 @@ object ClassPath {
def scalaLibrary = locate[Option[_]]
def scalaCompiler = locate[Global]
- def infoFor[T](value: T) = info(value.getClass)
- def info[T](clazz: Class[T]) = new ClassAndJarInfo()(ClassManifest[T](clazz))
- def info[T: ClassManifest] = new ClassAndJarInfo[T]
- def locate[T: ClassManifest] = info[T].rootClasspath
- def locateJar[T: ClassManifest] = info[T].rootPossibles find (x => isJarOrZip(x)) map (x => File(x))
- def locateDir[T: ClassManifest] = info[T].rootPossibles find (_.isDirectory) map (_.toDirectory)
+ def infoFor[T](value: T) = info(value.getClass)
+ def info[T](clazz: Class[T]) = new ClassAndJarInfo()(ClassTag[T](clazz))
+ def info[T: ClassTag] = new ClassAndJarInfo[T]
+ def locate[T: ClassTag] = info[T].rootClasspath
+ def locateJar[T: ClassTag] = info[T].rootPossibles find (x => isJarOrZip(x)) map (x => File(x))
+ def locateDir[T: ClassTag] = info[T].rootPossibles find (_.isDirectory) map (_.toDirectory)
/** Expand single path entry */
private def expandS(pattern: String): List[String] = {
diff --git a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
index 700fe0c1a6..120cceb238 100644
--- a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
+++ b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
@@ -67,8 +67,8 @@ trait ScalaClassLoader extends JClassLoader {
result
}
- def constructorsOf[T <: AnyRef : Manifest]: List[Constructor[T]] =
- manifest[T].erasure.getConstructors.toList map (_.asInstanceOf[Constructor[T]])
+ def constructorsOf[T <: AnyRef : ClassTag]: List[Constructor[T]] =
+ classTag[T].erasure.getConstructors.toList map (_.asInstanceOf[Constructor[T]])
/** The actual bytes for a class file, or an empty array if it can't be found. */
def classBytes(className: String): Array[Byte] = classAsStream(className) match {
@@ -125,9 +125,9 @@ object ScalaClassLoader {
def bootLoader = apply(null)
def contextChain = loaderChain(contextLoader)
- def pathToErasure[T: ClassManifest] = pathToClass(classManifest[T].erasure)
- def pathToClass(clazz: Class[_]) = clazz.getName.replace('.', JFile.separatorChar) + ".class"
- def locate[T: ClassManifest] = contextLoader getResource pathToErasure[T]
+ def pathToErasure[T: ClassTag] = pathToClass(classTag[T].erasure)
+ def pathToClass(clazz: Class[_]) = clazz.getName.replace('.', JFile.separatorChar) + ".class"
+ def locate[T: ClassTag] = contextLoader getResource pathToErasure[T]
/** Tries to guess the classpath by type matching the context classloader
* and its parents, looking for any classloaders which will reveal their
diff --git a/src/compiler/scala/tools/reflect/Invoked.scala b/src/compiler/scala/tools/reflect/Invoked.scala
index 30c6201a0d..516c6b9bf6 100644
--- a/src/compiler/scala/tools/reflect/Invoked.scala
+++ b/src/compiler/scala/tools/reflect/Invoked.scala
@@ -16,7 +16,7 @@ class Invoked private (val proxy: AnyRef, val m: Method, val args: List[AnyRef])
def name = m.getName
def arity = m.getParameterTypes.size
def returnType = m.getReturnType
- def returns[T: Manifest] = returnType == manifest[T].erasure
+ def returns[T: ClassTag] = returnType == classTag[T].erasure
def invokeOn(target: AnyRef) = m.invoke(target, args: _*)
def isObjectMethod = Set("toString", "equals", "hashCode") contains name
diff --git a/src/compiler/scala/tools/reflect/UniversalFn.scala b/src/compiler/scala/tools/reflect/UniversalFn.scala
index 9ccd580560..b0c2a19021 100644
--- a/src/compiler/scala/tools/reflect/UniversalFn.scala
+++ b/src/compiler/scala/tools/reflect/UniversalFn.scala
@@ -26,8 +26,8 @@ class UniversalFn private (val closure: AnyRef, val method: Method) extends (Seq
* them to this universal function. Will throw an exception in the
* face of any bad data.
*/
- def as[T: Manifest] : T = {
- val clazz = manifest[T].erasure
+ def as[T: ClassTag] : T = {
+ val clazz = classTag[T].erasure
require(clazz.isInterface, "Type argument must be an interface.")
val interfaceMethods = clazz.getDeclaredMethods.toSet
diff --git a/src/compiler/scala/tools/reflect/package.scala b/src/compiler/scala/tools/reflect/package.scala
index 744bf9b226..0b0c0905cb 100644
--- a/src/compiler/scala/tools/reflect/package.scala
+++ b/src/compiler/scala/tools/reflect/package.scala
@@ -7,7 +7,6 @@ package scala.tools
import java.lang.reflect.Method
import java.{ lang => jl }
-import scala.reflect.{mirror => rm}
package object reflect {
def nameAndArity(m: Method) = (m.getName, m.getParameterTypes.size)
@@ -28,17 +27,17 @@ package object reflect {
}
}
- def zeroOfClass(clazz: Class[_]) = zeroOf(Manifest(rm.classToType(clazz)))
- def zeroOf[T](implicit m: Manifest[T]): AnyRef = {
- if (m == manifest[Boolean] || m == manifest[jl.Boolean]) false: jl.Boolean
- else if (m == manifest[Unit] || m == manifest[jl.Void] || m == manifest[scala.runtime.BoxedUnit]) scala.runtime.BoxedUnit.UNIT
- else if (m == manifest[Char] || m == manifest[jl.Character]) 0.toChar: jl.Character
- else if (m == manifest[Byte] || m == manifest[jl.Byte]) 0.toByte: jl.Byte
- else if (m == manifest[Short] || m == manifest[jl.Short]) 0.toShort: jl.Short
- else if (m == manifest[Int] || m == manifest[jl.Integer]) 0: jl.Integer
- else if (m == manifest[Long] || m == manifest[jl.Long]) 0l: jl.Long
- else if (m == manifest[Float] || m == manifest[jl.Float]) 0f: jl.Float
- else if (m == manifest[Double] || m == manifest[jl.Double]) 0d: jl.Double
+ def zeroOfClass(clazz: Class[_]) = zeroOf(ClassTag(clazz))
+ def zeroOf[T](implicit t: ClassTag[T]): AnyRef = {
+ if (t == classTag[Boolean] || t == classTag[jl.Boolean]) false: jl.Boolean
+ else if (t == classTag[Unit] || t == classTag[jl.Void] || t == classTag[scala.runtime.BoxedUnit]) scala.runtime.BoxedUnit.UNIT
+ else if (t == classTag[Char] || t == classTag[jl.Character]) 0.toChar: jl.Character
+ else if (t == classTag[Byte] || t == classTag[jl.Byte]) 0.toByte: jl.Byte
+ else if (t == classTag[Short] || t == classTag[jl.Short]) 0.toShort: jl.Short
+ else if (t == classTag[Int] || t == classTag[jl.Integer]) 0: jl.Integer
+ else if (t == classTag[Long] || t == classTag[jl.Long]) 0l: jl.Long
+ else if (t == classTag[Float] || t == classTag[jl.Float]) 0f: jl.Float
+ else if (t == classTag[Double] || t == classTag[jl.Double]) 0d: jl.Double
else null
}
}
diff --git a/src/detach/library/scala/remoting/Channel.scala b/src/detach/library/scala/remoting/Channel.scala
index 541e45a477..54b8fb100e 100644
--- a/src/detach/library/scala/remoting/Channel.scala
+++ b/src/detach/library/scala/remoting/Channel.scala
@@ -116,20 +116,20 @@ class Channel protected (socket: Socket) {
* the expected type.
*/
@throws(classOf[ChannelException])
- def receive[T](implicit expected: reflect.Manifest[T]): T = {
- val found = in.readObject().asInstanceOf[reflect.Manifest[_]]
+ def receive[T](implicit expected: reflect.ClassTag[T]): T = {
+ val found = in.readObject().asInstanceOf[reflect.ClassTag[_]]
info("receive: found="+found+", expected="+expected)
- import scala.reflect.Manifest
+ import scala.reflect.ClassTag
val x = found match {
- case Manifest.Unit => ()
- case Manifest.Boolean => in.readBoolean()
- case Manifest.Byte => in.readByte()
- case Manifest.Char => in.readChar()
- case Manifest.Short => in.readShort()
- case Manifest.Int => in.readInt()
- case Manifest.Long => in.readLong()
- case Manifest.Float => in.readFloat()
- case Manifest.Double => in.readDouble()
+ case ClassTag.Unit => ()
+ case ClassTag.Boolean => in.readBoolean()
+ case ClassTag.Byte => in.readByte()
+ case ClassTag.Char => in.readChar()
+ case ClassTag.Short => in.readShort()
+ case ClassTag.Int => in.readInt()
+ case ClassTag.Long => in.readLong()
+ case ClassTag.Float => in.readFloat()
+ case ClassTag.Double => in.readDouble()
case _ => in.readObject()
}
val res = if (found <:< expected)
@@ -144,12 +144,12 @@ class Channel protected (socket: Socket) {
/** <code>?</code> method may throw either an
* <code>ClassNotFoundException</code> or an <code>IOException</code>.
*/
- def ?[T](implicit m: reflect.Manifest[T]): T = receive[T](m)
+ def ?[T](implicit t: reflect.ClassTag[T]): T = receive[T](t)
/** <code>send</code> method may throw an <code>IOException</code>.
*/
- def send[T](x: T)(implicit m: reflect.Manifest[T]) {
- out writeObject m
+ def send[T](x: T)(implicit t: reflect.ClassTag[T]) {
+ out writeObject t
x match {
case x: Unit => // nop
case x: Boolean => out writeBoolean x
@@ -168,7 +168,7 @@ class Channel protected (socket: Socket) {
/** <code>!</code> method may throw an <code>IOException</code>.
*/
- def ![T](x: T)(implicit m: reflect.Manifest[T]) { send(x)(m) }
+ def ![T](x: T)(implicit m: reflect.ClassTag[T]) { send(x)(m) }
def close() {
try { socket.close() }
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index 5b8ebde308..fd61cfd0a1 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -12,17 +12,17 @@ import scala.collection.generic._
import scala.collection.{ mutable, immutable }
import mutable.{ ArrayBuilder, ArraySeq }
import compat.Platform.arraycopy
-import scala.reflect.ClassManifest
+import scala.reflect.ArrayTag
import scala.runtime.ScalaRunTime.{ array_apply, array_update }
/** Contains a fallback builder for arrays when the element type
- * does not have a class manifest. In that case a generic array is built.
+ * does not have a class tag. In that case a generic array is built.
*/
class FallbackArrayBuilding {
/** A builder factory that generates a generic array.
* Called instead of `Array.newBuilder` if the element type of an array
- * does not have a class manifest. Note that fallbackBuilder factory
+ * does not have a class tag. Note that fallbackBuilder factory
* needs an implicit parameter (otherwise it would not be dominated in
* implicit search by `Array.canBuildFrom`). We make sure that
* implicit search is always successful.
@@ -48,16 +48,16 @@ class FallbackArrayBuilding {
* @version 1.0
*/
object Array extends FallbackArrayBuilding {
- implicit def canBuildFrom[T](implicit m: ClassManifest[T]): CanBuildFrom[Array[_], T, Array[T]] =
+ implicit def canBuildFrom[T](implicit t: ArrayTag[T]): CanBuildFrom[Array[_], T, Array[T]] =
new CanBuildFrom[Array[_], T, Array[T]] {
- def apply(from: Array[_]) = ArrayBuilder.make[T]()(m)
- def apply() = ArrayBuilder.make[T]()(m)
+ def apply(from: Array[_]) = ArrayBuilder.make[T]()(t)
+ def apply() = ArrayBuilder.make[T]()(t)
}
/**
* Returns a new [[scala.collection.mutable.ArrayBuilder]].
*/
- def newBuilder[T](implicit m: ClassManifest[T]): ArrayBuilder[T] = ArrayBuilder.make[T]()(m)
+ def newBuilder[T](implicit t: ArrayTag[T]): ArrayBuilder[T] = ArrayBuilder.make[T]()(t)
private def slowcopy(src : AnyRef,
srcPos : Int,
@@ -98,14 +98,14 @@ object Array extends FallbackArrayBuilding {
}
/** Returns an array of length 0 */
- def empty[T: ClassManifest]: Array[T] = new Array[T](0)
+ def empty[T: ArrayTag]: Array[T] = new Array[T](0)
/** Creates an array with given elements.
*
* @param xs the elements to put in the array
* @return an array containing all elements from xs.
*/
- def apply[T: ClassManifest](xs: T*): Array[T] = {
+ def apply[T: ArrayTag](xs: T*): Array[T] = {
val array = new Array[T](xs.length)
var i = 0
for (x <- xs.iterator) { array(i) = x; i += 1 }
@@ -194,23 +194,23 @@ object Array extends FallbackArrayBuilding {
}
/** Creates array with given dimensions */
- def ofDim[T: ClassManifest](n1: Int): Array[T] =
+ def ofDim[T: ArrayTag](n1: Int): Array[T] =
new Array[T](n1)
/** Creates a 2-dimensional array */
- def ofDim[T: ClassManifest](n1: Int, n2: Int): Array[Array[T]] = {
+ def ofDim[T: ArrayTag](n1: Int, n2: Int): Array[Array[T]] = {
val arr: Array[Array[T]] = (new Array[Array[T]](n1): Array[Array[T]])
for (i <- 0 until n1) arr(i) = new Array[T](n2)
arr
// tabulate(n1)(_ => ofDim[T](n2))
}
/** Creates a 3-dimensional array */
- def ofDim[T: ClassManifest](n1: Int, n2: Int, n3: Int): Array[Array[Array[T]]] =
+ def ofDim[T: ArrayTag](n1: Int, n2: Int, n3: Int): Array[Array[Array[T]]] =
tabulate(n1)(_ => ofDim[T](n2, n3))
/** Creates a 4-dimensional array */
- def ofDim[T: ClassManifest](n1: Int, n2: Int, n3: Int, n4: Int): Array[Array[Array[Array[T]]]] =
+ def ofDim[T: ArrayTag](n1: Int, n2: Int, n3: Int, n4: Int): Array[Array[Array[Array[T]]]] =
tabulate(n1)(_ => ofDim[T](n2, n3, n4))
/** Creates a 5-dimensional array */
- def ofDim[T: ClassManifest](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int): Array[Array[Array[Array[Array[T]]]]] =
+ def ofDim[T: ArrayTag](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int): Array[Array[Array[Array[Array[T]]]]] =
tabulate(n1)(_ => ofDim[T](n2, n3, n4, n5))
/** Concatenates all arrays into a single array.
@@ -218,7 +218,7 @@ object Array extends FallbackArrayBuilding {
* @param xss the given arrays
* @return the array created from concatenating `xss`
*/
- def concat[T: ClassManifest](xss: Array[T]*): Array[T] = {
+ def concat[T: ArrayTag](xss: Array[T]*): Array[T] = {
val b = newBuilder[T]
b.sizeHint(xss.map(_.size).sum)
for (xs <- xss) b ++= xs
@@ -239,7 +239,7 @@ object Array extends FallbackArrayBuilding {
* @return an Array of size n, where each element contains the result of computing
* `elem`.
*/
- def fill[T: ClassManifest](n: Int)(elem: => T): Array[T] = {
+ def fill[T: ArrayTag](n: Int)(elem: => T): Array[T] = {
val b = newBuilder[T]
b.sizeHint(n)
var i = 0
@@ -257,7 +257,7 @@ object Array extends FallbackArrayBuilding {
* @param n2 the number of elements in the 2nd dimension
* @param elem the element computation
*/
- def fill[T: ClassManifest](n1: Int, n2: Int)(elem: => T): Array[Array[T]] =
+ def fill[T: ArrayTag](n1: Int, n2: Int)(elem: => T): Array[Array[T]] =
tabulate(n1)(_ => fill(n2)(elem))
/** Returns a three-dimensional array that contains the results of some element
@@ -268,7 +268,7 @@ object Array extends FallbackArrayBuilding {
* @param n3 the number of elements in the 3nd dimension
* @param elem the element computation
*/
- def fill[T: ClassManifest](n1: Int, n2: Int, n3: Int)(elem: => T): Array[Array[Array[T]]] =
+ def fill[T: ArrayTag](n1: Int, n2: Int, n3: Int)(elem: => T): Array[Array[Array[T]]] =
tabulate(n1)(_ => fill(n2, n3)(elem))
/** Returns a four-dimensional array that contains the results of some element
@@ -280,7 +280,7 @@ object Array extends FallbackArrayBuilding {
* @param n4 the number of elements in the 4th dimension
* @param elem the element computation
*/
- def fill[T: ClassManifest](n1: Int, n2: Int, n3: Int, n4: Int)(elem: => T): Array[Array[Array[Array[T]]]] =
+ def fill[T: ArrayTag](n1: Int, n2: Int, n3: Int, n4: Int)(elem: => T): Array[Array[Array[Array[T]]]] =
tabulate(n1)(_ => fill(n2, n3, n4)(elem))
/** Returns a five-dimensional array that contains the results of some element
@@ -293,7 +293,7 @@ object Array extends FallbackArrayBuilding {
* @param n5 the number of elements in the 5th dimension
* @param elem the element computation
*/
- def fill[T: ClassManifest](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int)(elem: => T): Array[Array[Array[Array[Array[T]]]]] =
+ def fill[T: ArrayTag](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int)(elem: => T): Array[Array[Array[Array[Array[T]]]]] =
tabulate(n1)(_ => fill(n2, n3, n4, n5)(elem))
/** Returns an array containing values of a given function over a range of integer
@@ -303,7 +303,7 @@ object Array extends FallbackArrayBuilding {
* @param f The function computing element values
* @return A traversable consisting of elements `f(0),f(1), ..., f(n - 1)`
*/
- def tabulate[T: ClassManifest](n: Int)(f: Int => T): Array[T] = {
+ def tabulate[T: ArrayTag](n: Int)(f: Int => T): Array[T] = {
val b = newBuilder[T]
b.sizeHint(n)
var i = 0
@@ -321,7 +321,7 @@ object Array extends FallbackArrayBuilding {
* @param n2 the number of elements in the 2nd dimension
* @param f The function computing element values
*/
- def tabulate[T: ClassManifest](n1: Int, n2: Int)(f: (Int, Int) => T): Array[Array[T]] =
+ def tabulate[T: ArrayTag](n1: Int, n2: Int)(f: (Int, Int) => T): Array[Array[T]] =
tabulate(n1)(i1 => tabulate(n2)(f(i1, _)))
/** Returns a three-dimensional array containing values of a given function
@@ -332,7 +332,7 @@ object Array extends FallbackArrayBuilding {
* @param n3 the number of elements in the 3rd dimension
* @param f The function computing element values
*/
- def tabulate[T: ClassManifest](n1: Int, n2: Int, n3: Int)(f: (Int, Int, Int) => T): Array[Array[Array[T]]] =
+ def tabulate[T: ArrayTag](n1: Int, n2: Int, n3: Int)(f: (Int, Int, Int) => T): Array[Array[Array[T]]] =
tabulate(n1)(i1 => tabulate(n2, n3)(f(i1, _, _)))
/** Returns a four-dimensional array containing values of a given function
@@ -344,7 +344,7 @@ object Array extends FallbackArrayBuilding {
* @param n4 the number of elements in the 4th dimension
* @param f The function computing element values
*/
- def tabulate[T: ClassManifest](n1: Int, n2: Int, n3: Int, n4: Int)(f: (Int, Int, Int, Int) => T): Array[Array[Array[Array[T]]]] =
+ def tabulate[T: ArrayTag](n1: Int, n2: Int, n3: Int, n4: Int)(f: (Int, Int, Int, Int) => T): Array[Array[Array[Array[T]]]] =
tabulate(n1)(i1 => tabulate(n2, n3, n4)(f(i1, _, _, _)))
/** Returns a five-dimensional array containing values of a given function
@@ -357,7 +357,7 @@ object Array extends FallbackArrayBuilding {
* @param n5 the number of elements in the 5th dimension
* @param f The function computing element values
*/
- def tabulate[T: ClassManifest](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int)(f: (Int, Int, Int, Int, Int) => T): Array[Array[Array[Array[Array[T]]]]] =
+ def tabulate[T: ArrayTag](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int)(f: (Int, Int, Int, Int, Int) => T): Array[Array[Array[Array[Array[T]]]]] =
tabulate(n1)(i1 => tabulate(n2, n3, n4, n5)(f(i1, _, _, _, _)))
/** Returns an array containing a sequence of increasing integers in a range.
@@ -396,7 +396,7 @@ object Array extends FallbackArrayBuilding {
* @param f the function that is repeatedly applied
* @return the array returning `len` values in the sequence `start, f(start), f(f(start)), ...`
*/
- def iterate[T: ClassManifest](start: T, len: Int)(f: T => T): Array[T] = {
+ def iterate[T: ArrayTag](start: T, len: Int)(f: T => T): Array[T] = {
val b = newBuilder[T]
if (len > 0) {
@@ -476,7 +476,7 @@ object Array extends FallbackArrayBuilding {
* @define collectExample
* @define undefinedorder
* @define thatinfo the class of the returned collection. In the standard library configuration,
- * `That` is either `Array[B]` if a ClassManifest is available for B or `ArraySeq[B]` otherwise.
+ * `That` is either `Array[B]` if an ArrayTag is available for B or `ArraySeq[B]` otherwise.
* @define zipthatinfo $thatinfo
* @define bfinfo an implicit value of class `CanBuildFrom` which determines the result class `That` from the current
* representation type `Repr` and the new element type `B`.
diff --git a/src/library/scala/collection/GenTraversableOnce.scala b/src/library/scala/collection/GenTraversableOnce.scala
index a7ec7618b7..fd8595ccb8 100644
--- a/src/library/scala/collection/GenTraversableOnce.scala
+++ b/src/library/scala/collection/GenTraversableOnce.scala
@@ -459,7 +459,7 @@ trait GenTraversableOnce[+A] extends Any {
/** Converts this $coll to an array.
*
- * @tparam B the type of the elements of the array. A `ClassManifest` for
+ * @tparam B the type of the elements of the array. An `ArrayTag` for
* this type must be available.
* @return an array containing all elements of this $coll.
*
@@ -469,9 +469,9 @@ trait GenTraversableOnce[+A] extends Any {
* $willNotTerminateInf
*
* @return an array containing all elements of this $coll.
- * A `ClassManifest` must be available for the element type of this $coll.
+ * An `ArrayTag` must be available for the element type of this $coll.
*/
- def toArray[A1 >: A: ClassManifest]: Array[A1]
+ def toArray[A1 >: A: ArrayTag]: Array[A1]
/** Converts this $coll to a list.
* $willNotTerminateInf
diff --git a/src/library/scala/collection/Traversable.scala b/src/library/scala/collection/Traversable.scala
index 3fba3dfa79..a65be3ffcc 100644
--- a/src/library/scala/collection/Traversable.scala
+++ b/src/library/scala/collection/Traversable.scala
@@ -75,7 +75,7 @@ trait Traversable[+A] extends TraversableLike[A, Traversable[A]]
override def copyToBuffer[B >: A](dest: Buffer[B])
override def copyToArray[B >: A](xs: Array[B], start: Int, len: Int)
override def copyToArray[B >: A](xs: Array[B], start: Int)
- override def toArray[B >: A : ClassManifest]: Array[B]
+ override def toArray[B >: A : ArrayTag]: Array[B]
override def toList: List[A]
override def toIterable: Iterable[A]
override def toSeq: Seq[A]
diff --git a/src/library/scala/collection/TraversableOnce.scala b/src/library/scala/collection/TraversableOnce.scala
index e68ef9e4de..5b5cee7f1b 100644
--- a/src/library/scala/collection/TraversableOnce.scala
+++ b/src/library/scala/collection/TraversableOnce.scala
@@ -229,7 +229,7 @@ trait TraversableOnce[+A] extends Any with GenTraversableOnce[A] {
def copyToArray[B >: A](xs: Array[B]): Unit =
copyToArray(xs, 0, xs.length)
- def toArray[B >: A : ClassManifest]: Array[B] = {
+ def toArray[B >: A : ArrayTag]: Array[B] = {
if (isTraversableAgain) {
val result = new Array[B](size)
copyToArray(result, 0)
diff --git a/src/library/scala/collection/TraversableProxyLike.scala b/src/library/scala/collection/TraversableProxyLike.scala
index e7e797391e..20880e369d 100644
--- a/src/library/scala/collection/TraversableProxyLike.scala
+++ b/src/library/scala/collection/TraversableProxyLike.scala
@@ -73,7 +73,7 @@ trait TraversableProxyLike[+A, +Repr <: TraversableLike[A, Repr] with Traversabl
override def copyToArray[B >: A](xs: Array[B], start: Int, len: Int) = self.copyToArray(xs, start, len)
override def copyToArray[B >: A](xs: Array[B], start: Int) = self.copyToArray(xs, start)
override def copyToArray[B >: A](xs: Array[B]) = self.copyToArray(xs)
- override def toArray[B >: A: ClassManifest]: Array[B] = self.toArray
+ override def toArray[B >: A: ArrayTag]: Array[B] = self.toArray
override def toList: List[A] = self.toList
override def toIterable: Iterable[A] = self.toIterable
override def toSeq: Seq[A] = self.toSeq
diff --git a/src/library/scala/collection/generic/ClassManifestTraversableFactory.scala b/src/library/scala/collection/generic/ArrayTagTraversableFactory.scala
index e418ca623f..d9ab17559e 100644
--- a/src/library/scala/collection/generic/ClassManifestTraversableFactory.scala
+++ b/src/library/scala/collection/generic/ArrayTagTraversableFactory.scala
@@ -11,7 +11,7 @@ package generic
import language.higherKinds
-/** A template for companion objects of `ClassManifestTraversable` and
+/** A template for companion objects of `ClassTagTraversable` and
* subclasses thereof.
*
* @define coll collection
@@ -21,11 +21,11 @@ import language.higherKinds
* @author Aleksandar Prokopec
* @since 2.8
*/
-abstract class ClassManifestTraversableFactory[CC[X] <: Traversable[X] with GenericClassManifestTraversableTemplate[X, CC]]
- extends GenericClassManifestCompanion[CC] {
+abstract class ArrayTagTraversableFactory[CC[X] <: Traversable[X] with GenericArrayTagTraversableTemplate[X, CC]]
+ extends GenericArrayTagCompanion[CC] {
- class GenericCanBuildFrom[A](implicit manif: ClassManifest[A]) extends CanBuildFrom[CC[_], A, CC[A]] {
- def apply(from: CC[_]) = from.genericClassManifestBuilder[A]
+ class GenericCanBuildFrom[A](implicit tag: ArrayTag[A]) extends CanBuildFrom[CC[_], A, CC[A]] {
+ def apply(from: CC[_]) = from.genericArrayTagBuilder[A]
def apply = newBuilder[A]
}
}
diff --git a/src/library/scala/collection/generic/GenericClassManifestCompanion.scala b/src/library/scala/collection/generic/GenericArrayTagCompanion.scala
index f357091361..959adbce6d 100644
--- a/src/library/scala/collection/generic/GenericClassManifestCompanion.scala
+++ b/src/library/scala/collection/generic/GenericArrayTagCompanion.scala
@@ -12,19 +12,19 @@ package generic
import mutable.Builder
import language.higherKinds
-/** This class represents companions of classes which require ClassManifests
+/** This class represents companions of classes which require ArrayTags
* for their element types.
*
* @author Aleksandar Prokopec
*/
-abstract class GenericClassManifestCompanion[+CC[X] <: Traversable[X]] {
+abstract class GenericArrayTagCompanion[+CC[X] <: Traversable[X]] {
type Coll = CC[_]
- def newBuilder[A](implicit ord: ClassManifest[A]): Builder[A, CC[A]]
+ def newBuilder[A](implicit ord: ArrayTag[A]): Builder[A, CC[A]]
- def empty[A: ClassManifest]: CC[A] = newBuilder[A].result
+ def empty[A: ArrayTag]: CC[A] = newBuilder[A].result
- def apply[A](elems: A*)(implicit ord: ClassManifest[A]): CC[A] = {
+ def apply[A](elems: A*)(implicit ord: ArrayTag[A]): CC[A] = {
val b = newBuilder[A]
b ++= elems
b.result
diff --git a/src/library/scala/collection/generic/GenericArrayTagTraversableTemplate.scala b/src/library/scala/collection/generic/GenericArrayTagTraversableTemplate.scala
new file mode 100644
index 0000000000..ac84683c59
--- /dev/null
+++ b/src/library/scala/collection/generic/GenericArrayTagTraversableTemplate.scala
@@ -0,0 +1,30 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2010-2011, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.collection
+package generic
+
+import mutable.Builder
+import annotation.unchecked.uncheckedVariance
+import language.higherKinds
+
+/** This trait represents collections classes which require array
+ * tags for their element types.
+ *
+ * @author Aleksandar Prokopec
+ * @since 2.8
+ */
+trait GenericArrayTagTraversableTemplate[+A, +CC[X] <: Traversable[X]] extends HasNewBuilder[A, CC[A] @uncheckedVariance] {
+ implicit protected[this] val tag: ArrayTag[A]
+ def arrayTagCompanion: GenericArrayTagCompanion[CC]
+ def genericArrayTagBuilder[B](implicit tag: ArrayTag[B]): Builder[B, CC[B]] = arrayTagCompanion.newBuilder[B]
+ @deprecated("use arrayTagCompanion instead", "2.10.0")
+ def classManifestCompanion: GenericClassManifestCompanion[CC] = arrayTagCompanion
+ @deprecated("use genericArrayTagBuilder instead", "2.10.0")
+ def genericClassManifestBuilder[B](implicit manifest: ClassManifest[B]): Builder[B, CC[B]] = genericArrayTagBuilder[B](manifest)
+}
diff --git a/src/library/scala/collection/generic/GenericClassManifestTraversableTemplate.scala b/src/library/scala/collection/generic/GenericClassManifestTraversableTemplate.scala
deleted file mode 100644
index 1a5db4bab2..0000000000
--- a/src/library/scala/collection/generic/GenericClassManifestTraversableTemplate.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2010-2011, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.collection
-package generic
-
-import mutable.Builder
-import annotation.unchecked.uncheckedVariance
-import language.higherKinds
-
-/** This trait represents collections classes which require class
- * manifests for their element types.
- *
- * @author Aleksandar Prokopec
- * @since 2.8
- */
-trait GenericClassManifestTraversableTemplate[+A, +CC[X] <: Traversable[X]] extends HasNewBuilder[A, CC[A] @uncheckedVariance] {
- implicit protected[this] val manifest: ClassManifest[A]
- def classManifestCompanion: GenericClassManifestCompanion[CC]
- def genericClassManifestBuilder[B](implicit man: ClassManifest[B]): Builder[B, CC[B]] = classManifestCompanion.newBuilder[B]
-}
diff --git a/src/library/scala/collection/generic/TraversableForwarder.scala b/src/library/scala/collection/generic/TraversableForwarder.scala
index 3d723a1feb..3d5bc2704f 100644
--- a/src/library/scala/collection/generic/TraversableForwarder.scala
+++ b/src/library/scala/collection/generic/TraversableForwarder.scala
@@ -57,7 +57,7 @@ trait TraversableForwarder[+A] extends Traversable[A] {
override def copyToArray[B >: A](xs: Array[B], start: Int, len: Int) = underlying.copyToArray(xs, start, len)
override def copyToArray[B >: A](xs: Array[B], start: Int) = underlying.copyToArray(xs, start)
override def copyToArray[B >: A](xs: Array[B]) = underlying.copyToArray(xs)
- override def toArray[B >: A: ClassManifest]: Array[B] = underlying.toArray
+ override def toArray[B >: A: ArrayTag]: Array[B] = underlying.toArray
override def toList: List[A] = underlying.toList
override def toIterable: Iterable[A] = underlying.toIterable
override def toSeq: Seq[A] = underlying.toSeq
diff --git a/src/library/scala/collection/generic/package.scala b/src/library/scala/collection/generic/package.scala
index 0457fef227..32006b4bf0 100644
--- a/src/library/scala/collection/generic/package.scala
+++ b/src/library/scala/collection/generic/package.scala
@@ -3,4 +3,13 @@ import generic.CanBuildFrom
package object generic {
type CanBuild[-Elem, +To] = CanBuildFrom[Nothing, Elem, To]
+
+ @deprecated("use ArrayTagTraversableFactory instead", "2.10.0")
+ type ClassManifestTraversableFactory[CC[X] <: Traversable[X] with GenericClassManifestTraversableTemplate[X, CC]] = ArrayTagTraversableFactory[CC]
+
+ @deprecated("use GenericArrayTagCompanion instead", "2.10.0")
+ type GenericClassManifestCompanion[+CC[X] <: Traversable[X]] = GenericArrayTagCompanion[CC]
+
+ @deprecated("use GenericArrayTagTraversableTemplate instead", "2.10.0")
+ type GenericClassManifestTraversableTemplate[+A, +CC[X] <: Traversable[X]] = GenericArrayTagTraversableTemplate[A, CC]
} \ No newline at end of file
diff --git a/src/library/scala/collection/immutable/PagedSeq.scala b/src/library/scala/collection/immutable/PagedSeq.scala
index 97c7c789f8..68c75ee586 100644
--- a/src/library/scala/collection/immutable/PagedSeq.scala
+++ b/src/library/scala/collection/immutable/PagedSeq.scala
@@ -25,7 +25,7 @@ object PagedSeq {
final val UndeterminedEnd = Int.MaxValue
/** Constructs a paged sequence from an iterator */
- def fromIterator[T: ClassManifest](source: Iterator[T]): PagedSeq[T] =
+ def fromIterator[T: ArrayTag](source: Iterator[T]): PagedSeq[T] =
new PagedSeq[T]((data: Array[T], start: Int, len: Int) => {
var i = 0
while (i < len && source.hasNext) {
@@ -36,7 +36,7 @@ object PagedSeq {
})
/** Constructs a paged sequence from an iterable */
- def fromIterable[T: ClassManifest](source: Iterable[T]): PagedSeq[T] =
+ def fromIterable[T: ArrayTag](source: Iterable[T]): PagedSeq[T] =
fromIterator(source.iterator)
/** Constructs a paged character sequence from a string iterator */
@@ -115,7 +115,7 @@ import PagedSeq._
* It returns the number of elements produced, or -1 if end of logical input stream was reached
* before reading any element.
*
- * @tparam T the type of the elements contained in this paged sequence, with a `ClassManifest` context bound.
+ * @tparam T the type of the elements contained in this paged sequence, with an `ArrayTag` context bound.
*
* @author Martin Odersky
* @since 2.7
@@ -124,7 +124,7 @@ import PagedSeq._
* @define mayNotTerminateInf
* @define willNotTerminateInf
*/
-class PagedSeq[T: ClassManifest] protected(
+class PagedSeq[T: ArrayTag] protected(
more: (Array[T], Int, Int) => Int,
first1: Page[T],
start: Int,
@@ -205,7 +205,7 @@ extends scala.collection.AbstractSeq[T]
/** Page containing up to PageSize characters of the input sequence.
*/
-private class Page[T: ClassManifest](val num: Int) {
+private class Page[T: ArrayTag](val num: Int) {
private final val PageSize = 4096
diff --git a/src/library/scala/collection/immutable/StringLike.scala b/src/library/scala/collection/immutable/StringLike.scala
index 06f09f359f..52032a1cde 100644
--- a/src/library/scala/collection/immutable/StringLike.scala
+++ b/src/library/scala/collection/immutable/StringLike.scala
@@ -239,7 +239,7 @@ self =>
else
throw new IllegalArgumentException("For input string: \"null\"")
- override def toArray[B >: Char : ClassManifest]: Array[B] =
+ override def toArray[B >: Char : ArrayTag]: Array[B] =
toString.toCharArray.asInstanceOf[Array[B]]
private def unwrapArg(arg: Any): AnyRef = arg match {
diff --git a/src/library/scala/collection/interfaces/IterableMethods.scala b/src/library/scala/collection/interfaces/IterableMethods.scala
index 2054922e59..8efc3fe6f9 100644
--- a/src/library/scala/collection/interfaces/IterableMethods.scala
+++ b/src/library/scala/collection/interfaces/IterableMethods.scala
@@ -11,7 +11,6 @@ package interfaces
import generic._
import mutable.Buffer
-import scala.reflect.ClassManifest
import annotation.unchecked.uncheckedVariance
/**
diff --git a/src/library/scala/collection/interfaces/SeqMethods.scala b/src/library/scala/collection/interfaces/SeqMethods.scala
index 1f5b08d036..4327073d21 100644
--- a/src/library/scala/collection/interfaces/SeqMethods.scala
+++ b/src/library/scala/collection/interfaces/SeqMethods.scala
@@ -11,7 +11,6 @@ package interfaces
import generic._
import mutable.Buffer
-import scala.reflect.ClassManifest
/**
* @since 2.8
diff --git a/src/library/scala/collection/interfaces/SetMethods.scala b/src/library/scala/collection/interfaces/SetMethods.scala
index ffe141ed82..3b6214f45c 100644
--- a/src/library/scala/collection/interfaces/SetMethods.scala
+++ b/src/library/scala/collection/interfaces/SetMethods.scala
@@ -11,7 +11,6 @@ package interfaces
import generic._
import mutable.Buffer
-import scala.reflect.ClassManifest
import annotation.unchecked.uncheckedVariance
/**
diff --git a/src/library/scala/collection/interfaces/TraversableOnceMethods.scala b/src/library/scala/collection/interfaces/TraversableOnceMethods.scala
index 471e977134..543d59d118 100644
--- a/src/library/scala/collection/interfaces/TraversableOnceMethods.scala
+++ b/src/library/scala/collection/interfaces/TraversableOnceMethods.scala
@@ -46,7 +46,7 @@ trait TraversableOnceMethods[+A] {
def copyToBuffer[B >: A](dest: mutable.Buffer[B]): Unit
// conversions
- def toArray[B >: A : ClassManifest]: Array[B]
+ def toArray[B >: A : ArrayTag]: Array[B]
def toBuffer[B >: A]: mutable.Buffer[B]
def toIndexedSeq: immutable.IndexedSeq[A]
def toIterable: Iterable[A]
diff --git a/src/library/scala/collection/mutable/ArrayBuilder.scala b/src/library/scala/collection/mutable/ArrayBuilder.scala
index e396b0695e..293e85a97e 100644
--- a/src/library/scala/collection/mutable/ArrayBuilder.scala
+++ b/src/library/scala/collection/mutable/ArrayBuilder.scala
@@ -12,7 +12,8 @@ package scala.collection
package mutable
import generic._
-import scala.reflect.ClassManifest
+import scala.reflect.ArrayTag
+import scala.runtime.ScalaRunTime
/** A builder class for arrays.
*
@@ -30,12 +31,12 @@ object ArrayBuilder {
/** Creates a new arraybuilder of type `T`.
*
- * @tparam T type of the elements for the array builder, with a `ClassManifest` context bound.
+ * @tparam T type of the elements for the array builder, with a `ArrayTag` context bound.
* @return a new empty array builder.
*/
- def make[T: ClassManifest](): ArrayBuilder[T] = {
- val manifest = implicitly[ClassManifest[T]]
- val erasure = manifest.erasure
+ def make[T: ArrayTag](): ArrayBuilder[T] = {
+ val tag = implicitly[ArrayTag[T]]
+ val erasure = ScalaRunTime.arrayElementClass(tag)
erasure match {
case java.lang.Byte.TYPE => new ArrayBuilder.ofByte().asInstanceOf[ArrayBuilder[T]]
case java.lang.Short.TYPE => new ArrayBuilder.ofShort().asInstanceOf[ArrayBuilder[T]]
@@ -46,15 +47,15 @@ object ArrayBuilder {
case java.lang.Double.TYPE => new ArrayBuilder.ofDouble().asInstanceOf[ArrayBuilder[T]]
case java.lang.Boolean.TYPE => new ArrayBuilder.ofBoolean().asInstanceOf[ArrayBuilder[T]]
case java.lang.Void.TYPE => new ArrayBuilder.ofUnit().asInstanceOf[ArrayBuilder[T]]
- case _ => new ArrayBuilder.ofRef[T with AnyRef]()(manifest.asInstanceOf[ClassManifest[T with AnyRef]]).asInstanceOf[ArrayBuilder[T]]
+ case _ => new ArrayBuilder.ofRef[T with AnyRef]()(tag.asInstanceOf[ArrayTag[T with AnyRef]]).asInstanceOf[ArrayBuilder[T]]
}
}
/** A class for array builders for arrays of reference types.
*
- * @tparam T type of elements for the array builder, subtype of `AnyRef` with a `ClassManifest` context bound.
+ * @tparam T type of elements for the array builder, subtype of `AnyRef` with a `ArrayTag` context bound.
*/
- class ofRef[T <: AnyRef : ClassManifest] extends ArrayBuilder[T] {
+ class ofRef[T <: AnyRef : ArrayTag] extends ArrayBuilder[T] {
private var elems: Array[T] = _
private var capacity: Int = 0
diff --git a/src/library/scala/collection/mutable/ArrayOps.scala b/src/library/scala/collection/mutable/ArrayOps.scala
index 875030ade0..5f0e1e1071 100644
--- a/src/library/scala/collection/mutable/ArrayOps.scala
+++ b/src/library/scala/collection/mutable/ArrayOps.scala
@@ -12,7 +12,8 @@ package scala.collection
package mutable
import compat.Platform.arraycopy
-import scala.reflect.ClassManifest
+import scala.reflect.ArrayTag
+import scala.runtime.ScalaRunTime._
import parallel.mutable.ParArray
@@ -37,10 +38,8 @@ import parallel.mutable.ParArray
*/
abstract class ArrayOps[T] extends ArrayLike[T, Array[T]] with CustomParallelizable[T, ParArray[T]] {
- private def rowBuilder[U]: Builder[U, Array[U]] =
- Array.newBuilder(
- ClassManifest[U](
- repr.getClass.getComponentType.getComponentType))
+ private def elementClass: Class[_] =
+ arrayElementClass(repr.getClass)
override def copyToArray[U >: T](xs: Array[U], start: Int, len: Int) {
var l = math.min(len, repr.length)
@@ -48,11 +47,13 @@ abstract class ArrayOps[T] extends ArrayLike[T, Array[T]] with CustomParalleliza
Array.copy(repr, 0, xs, start, l)
}
- override def toArray[U >: T : ClassManifest]: Array[U] =
- if (implicitly[ClassManifest[U]].erasure eq repr.getClass.getComponentType)
+ override def toArray[U >: T : ArrayTag]: Array[U] = {
+ val thatElementClass = arrayElementClass(implicitly[ArrayTag[U]])
+ if (elementClass eq thatElementClass)
repr.asInstanceOf[Array[U]]
else
super.toArray[U]
+ }
override def par = ParArray.handoff(repr)
@@ -63,7 +64,7 @@ abstract class ArrayOps[T] extends ArrayLike[T, Array[T]] with CustomParalleliza
* @param asArray A function that converts elements of this array to rows - arrays of type `U`.
* @return An array obtained by concatenating rows of this array.
*/
- def flatten[U, To](implicit asTrav: T => collection.Traversable[U], m: ClassManifest[U]): Array[U] = {
+ def flatten[U, To](implicit asTrav: T => collection.Traversable[U], m: ArrayTag[U]): Array[U] = {
val b = Array.newBuilder[U]
b.sizeHint(map{case is: collection.IndexedSeq[_] => is.size case _ => 0}.sum)
for (xs <- this)
@@ -78,7 +79,8 @@ abstract class ArrayOps[T] extends ArrayLike[T, Array[T]] with CustomParalleliza
* @return An array obtained by replacing elements of this arrays with rows the represent.
*/
def transpose[U](implicit asArray: T => Array[U]): Array[Array[U]] = {
- val bs = asArray(head) map (_ => rowBuilder[U])
+ def mkRowBuilder() = Array.newBuilder(ClassTag[U](arrayElementClass(elementClass)))
+ val bs = asArray(head) map (_ => mkRowBuilder())
for (xs <- this) {
var i = 0
for (x <- asArray(xs)) {
@@ -86,9 +88,7 @@ abstract class ArrayOps[T] extends ArrayLike[T, Array[T]] with CustomParalleliza
i += 1
}
}
- val bb: Builder[Array[U], Array[Array[U]]] = Array.newBuilder(
- ClassManifest[Array[U]](
- repr.getClass.getComponentType))
+ val bb: Builder[Array[U], Array[Array[U]]] = Array.newBuilder(ClassTag[Array[U]](elementClass))
for (b <- bs) bb += b.result
bb.result
}
@@ -109,8 +109,7 @@ object ArrayOps {
override protected[this] def thisCollection: WrappedArray[T] = new WrappedArray.ofRef[T](repr)
override protected[this] def toCollection(repr: Array[T]): WrappedArray[T] = new WrappedArray.ofRef[T](repr)
- override protected[this] def newBuilder = new ArrayBuilder.ofRef[T]()(
- ClassManifest[T](repr.getClass.getComponentType))
+ override protected[this] def newBuilder = new ArrayBuilder.ofRef[T]()(ClassTag[T](arrayElementClass(repr.getClass)))
def length: Int = repr.length
def apply(index: Int): T = repr(index)
diff --git a/src/library/scala/collection/mutable/ArrayStack.scala b/src/library/scala/collection/mutable/ArrayStack.scala
index f5287312b9..b3a0534826 100644
--- a/src/library/scala/collection/mutable/ArrayStack.scala
+++ b/src/library/scala/collection/mutable/ArrayStack.scala
@@ -21,7 +21,7 @@ object ArrayStack extends SeqFactory[ArrayStack] {
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, ArrayStack[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]]
def newBuilder[A]: Builder[A, ArrayStack[A]] = new ArrayStack[A]
def empty: ArrayStack[Nothing] = new ArrayStack()
- def apply[A: ClassManifest](elems: A*): ArrayStack[A] = {
+ def apply[A: ArrayTag](elems: A*): ArrayStack[A] = {
val els: Array[AnyRef] = elems.reverseMap(_.asInstanceOf[AnyRef])(breakOut)
if (els.length == 0) new ArrayStack()
else new ArrayStack[A](els, els.length)
diff --git a/src/library/scala/collection/mutable/FlatArray.scala b/src/library/scala/collection/mutable/FlatArray.scala
index 3e43b66ecf..5b4b5e777f 100644
--- a/src/library/scala/collection/mutable/FlatArray.scala
+++ b/src/library/scala/collection/mutable/FlatArray.scala
@@ -11,7 +11,7 @@
package scala.collection
package mutable
-import scala.reflect.ClassManifest
+import scala.reflect.ArrayTag
import generic.CanBuildFrom
/**
@@ -62,16 +62,16 @@ object FlatArray {
def ofDim[Boxed, Unboxed](size:Int)
(implicit boxings: BoxingConversions[Boxed, Unboxed],
- manifest: ClassManifest[Unboxed]): FlatArray[Boxed] = {
+ tag: ArrayTag[Unboxed]): FlatArray[Boxed] = {
val elems = Array.ofDim[Unboxed](size)
- new FlatArray.Impl(elems, boxings, manifest)
+ new FlatArray.Impl(elems, boxings, tag)
}
def empty[Boxed, Unboxed](implicit boxings: BoxingConversions[Boxed, Unboxed],
- elemManifest: ClassManifest[Unboxed]): FlatArray[Boxed] = apply()
+ elemTag: ArrayTag[Unboxed]): FlatArray[Boxed] = apply()
def apply[Boxed, Unboxed](elems: Boxed*)
- (implicit boxings: BoxingConversions[Boxed, Unboxed], elemManifest: ClassManifest[Unboxed]): FlatArray[Boxed] = {
+ (implicit boxings: BoxingConversions[Boxed, Unboxed], elemTag: ArrayTag[Unboxed]): FlatArray[Boxed] = {
val b = newBuilder[Boxed, Unboxed]
b.sizeHint(elems.length)
b ++= elems
@@ -79,13 +79,13 @@ object FlatArray {
}
def newBuilder[Boxed, Unboxed]
- (implicit boxings: BoxingConversions[Boxed, Unboxed], elemManifest: ClassManifest[Unboxed]): Builder[Boxed, FlatArray[Boxed]] =
- new Bldr[Boxed, Unboxed](boxings, elemManifest)
+ (implicit boxings: BoxingConversions[Boxed, Unboxed], elemTag: ArrayTag[Unboxed]): Builder[Boxed, FlatArray[Boxed]] =
+ new Bldr[Boxed, Unboxed](boxings, elemTag)
implicit def canBuildFrom[Boxed, Unboxed](
implicit
boxings: BoxingConversions[Boxed, Unboxed],
- elemManifest: ClassManifest[Unboxed]): CanBuildFrom[FlatArray[_], Boxed, FlatArray[Boxed]] =
+ elemTag: ArrayTag[Unboxed]): CanBuildFrom[FlatArray[_], Boxed, FlatArray[Boxed]] =
new CanBuildFrom[FlatArray[_], Boxed, FlatArray[Boxed]] {
def apply(from: FlatArray[_]): Builder[Boxed, FlatArray[Boxed]] =
newBuilder[Boxed, Unboxed]
@@ -93,14 +93,14 @@ object FlatArray {
newBuilder[Boxed, Unboxed]
}
- private class Bldr[Boxed, Unboxed](boxings: BoxingConversions[Boxed, Unboxed], manifest: ClassManifest[Unboxed]) extends Builder[Boxed, FlatArray[Boxed]] {
+ private class Bldr[Boxed, Unboxed](boxings: BoxingConversions[Boxed, Unboxed], tag: ArrayTag[Unboxed]) extends Builder[Boxed, FlatArray[Boxed]] {
private var elems: Array[Unboxed] = _
private var capacity: Int = 0
private var size: Int = 0
private def resize(size: Int) {
- val newelems = manifest.newArray(size)
+ val newelems = tag.newArray(size)
if (this.size > 0) Array.copy(elems, 0, newelems, 0, this.size)
elems = newelems
capacity = size
@@ -131,14 +131,14 @@ object FlatArray {
def result(): FlatArray[Boxed] = {
if (capacity == 0 || capacity != size) resize(size)
- new FlatArray.Impl(elems, boxings, manifest)
+ new FlatArray.Impl(elems, boxings, tag)
}
}
private class Impl[Boxed, Unboxed](
elems: Array[Unboxed],
boxings: BoxingConversions[Boxed, Unboxed],
- elemManifest: ClassManifest[Unboxed]) extends FlatArray[Boxed] {
+ elemTag: ArrayTag[Unboxed]) extends FlatArray[Boxed] {
def length = elems.length
@@ -149,9 +149,9 @@ object FlatArray {
/** Creates new builder for this collection ==> move to subclasses
*/
override protected[this] def newBuilder: Builder[Boxed, FlatArray[Boxed]] =
- new Bldr[Boxed, Unboxed](boxings, elemManifest)
+ new Bldr[Boxed, Unboxed](boxings, elemTag)
/** Clones this object, including the underlying Array. */
- override def clone: FlatArray[Boxed] = new Impl[Boxed, Unboxed](elems.clone(), boxings, elemManifest)
+ override def clone: FlatArray[Boxed] = new Impl[Boxed, Unboxed](elems.clone(), boxings, elemTag)
}
}
diff --git a/src/library/scala/collection/mutable/UnrolledBuffer.scala b/src/library/scala/collection/mutable/UnrolledBuffer.scala
index 09e6088782..889768d471 100644
--- a/src/library/scala/collection/mutable/UnrolledBuffer.scala
+++ b/src/library/scala/collection/mutable/UnrolledBuffer.scala
@@ -41,11 +41,11 @@ import annotation.tailrec
*
*/
@SerialVersionUID(1L)
-class UnrolledBuffer[T](implicit val manifest: ClassManifest[T])
+class UnrolledBuffer[T](implicit val tag: ArrayTag[T])
extends collection.mutable.AbstractBuffer[T]
with collection.mutable.Buffer[T]
with collection.mutable.BufferLike[T, UnrolledBuffer[T]]
- with GenericClassManifestTraversableTemplate[T, UnrolledBuffer]
+ with GenericArrayTagTraversableTemplate[T, UnrolledBuffer]
with collection.mutable.Builder[T, UnrolledBuffer[T]]
with Serializable
{
@@ -67,7 +67,7 @@ extends collection.mutable.AbstractBuffer[T]
private[collection] def calcNextLength(sz: Int) = sz
- def classManifestCompanion = UnrolledBuffer
+ def arrayTagCompanion = UnrolledBuffer
/** Concatenates the targer unrolled buffer to this unrolled buffer.
*
@@ -183,11 +183,11 @@ extends collection.mutable.AbstractBuffer[T]
}
-object UnrolledBuffer extends ClassManifestTraversableFactory[UnrolledBuffer] {
+object UnrolledBuffer extends ArrayTagTraversableFactory[UnrolledBuffer] {
/** $genericCanBuildFromInfo */
- implicit def canBuildFrom[T](implicit m: ClassManifest[T]): CanBuildFrom[Coll, T, UnrolledBuffer[T]] =
+ implicit def canBuildFrom[T](implicit t: ArrayTag[T]): CanBuildFrom[Coll, T, UnrolledBuffer[T]] =
new GenericCanBuildFrom[T]
- def newBuilder[T](implicit m: ClassManifest[T]): Builder[T, UnrolledBuffer[T]] = new UnrolledBuffer[T]
+ def newBuilder[T](implicit t: ArrayTag[T]): Builder[T, UnrolledBuffer[T]] = new UnrolledBuffer[T]
val waterline = 50
val waterlineDelim = 100
@@ -195,7 +195,7 @@ object UnrolledBuffer extends ClassManifestTraversableFactory[UnrolledBuffer] {
/** Unrolled buffer node.
*/
- class Unrolled[T: ClassManifest] private[collection] (var size: Int, var array: Array[T], var next: Unrolled[T], val buff: UnrolledBuffer[T] = null) {
+ class Unrolled[T: ArrayTag] private[collection] (var size: Int, var array: Array[T], var next: Unrolled[T], val buff: UnrolledBuffer[T] = null) {
private[collection] def this() = this(0, new Array[T](unrolledlength), null, null)
private[collection] def this(b: UnrolledBuffer[T]) = this(0, new Array[T](unrolledlength), null, b)
diff --git a/src/library/scala/collection/mutable/WrappedArray.scala b/src/library/scala/collection/mutable/WrappedArray.scala
index fac4eb77bb..5e20f4ec61 100644
--- a/src/library/scala/collection/mutable/WrappedArray.scala
+++ b/src/library/scala/collection/mutable/WrappedArray.scala
@@ -11,7 +11,8 @@
package scala.collection
package mutable
-import scala.reflect.ClassManifest
+import scala.reflect.ArrayTag
+import scala.runtime.ScalaRunTime._
import scala.collection.generic._
import scala.collection.parallel.mutable.ParArray
@@ -40,8 +41,11 @@ extends AbstractSeq[T]
override protected[this] def thisCollection: WrappedArray[T] = this
override protected[this] def toCollection(repr: WrappedArray[T]): WrappedArray[T] = repr
- /** The manifest of the element type */
- def elemManifest: ClassManifest[T]
+ /** The tag of the element type */
+ def elemTag: ArrayTag[T]
+
+ @deprecated("use elemTag instead", "2.10.0")
+ def elemManifest: ClassManifest[T] = ClassManifest[T](arrayElementClass(elemTag))
/** The length of the array */
def length: Int
@@ -57,11 +61,16 @@ extends AbstractSeq[T]
override def par = ParArray.handoff(array)
- override def toArray[U >: T : ClassManifest]: Array[U] =
- if (implicitly[ClassManifest[U]].erasure eq array.getClass.getComponentType)
+ private def elementClass: Class[_] =
+ arrayElementClass(repr.getClass)
+
+ override def toArray[U >: T : ArrayTag]: Array[U] = {
+ val thatElementClass = arrayElementClass(implicitly[ArrayTag[U]])
+ if (elementClass eq thatElementClass)
array.asInstanceOf[Array[U]]
else
super.toArray[U]
+ }
override def stringPrefix = "WrappedArray"
@@ -71,7 +80,7 @@ extends AbstractSeq[T]
/** Creates new builder for this collection ==> move to subclasses
*/
override protected[this] def newBuilder: Builder[T, WrappedArray[T]] =
- new WrappedArrayBuilder[T](elemManifest)
+ new WrappedArrayBuilder[T](elemTag)
}
@@ -101,7 +110,7 @@ object WrappedArray {
case x: Array[Unit] => new ofUnit(x)
}).asInstanceOf[WrappedArray[T]]
- implicit def canBuildFrom[T](implicit m: ClassManifest[T]): CanBuildFrom[WrappedArray[_], T, WrappedArray[T]] =
+ implicit def canBuildFrom[T](implicit m: ArrayTag[T]): CanBuildFrom[WrappedArray[_], T, WrappedArray[T]] =
new CanBuildFrom[WrappedArray[_], T, WrappedArray[T]] {
def apply(from: WrappedArray[_]): Builder[T, WrappedArray[T]] =
ArrayBuilder.make[T]()(m) mapResult WrappedArray.make[T]
@@ -112,70 +121,70 @@ object WrappedArray {
def newBuilder[A]: Builder[A, IndexedSeq[A]] = new ArrayBuffer
final class ofRef[T <: AnyRef](val array: Array[T]) extends WrappedArray[T] with Serializable {
- lazy val elemManifest = ClassManifest[T](array.getClass.getComponentType)
+ lazy val elemTag = ClassTag[T](arrayElementClass(array.getClass))
def length: Int = array.length
def apply(index: Int): T = array(index).asInstanceOf[T]
def update(index: Int, elem: T) { array(index) = elem }
}
final class ofByte(val array: Array[Byte]) extends WrappedArray[Byte] with Serializable {
- def elemManifest = ClassManifest.Byte
+ def elemTag = ClassTag.Byte
def length: Int = array.length
def apply(index: Int): Byte = array(index)
def update(index: Int, elem: Byte) { array(index) = elem }
}
final class ofShort(val array: Array[Short]) extends WrappedArray[Short] with Serializable {
- def elemManifest = ClassManifest.Short
+ def elemTag = ClassTag.Short
def length: Int = array.length
def apply(index: Int): Short = array(index)
def update(index: Int, elem: Short) { array(index) = elem }
}
final class ofChar(val array: Array[Char]) extends WrappedArray[Char] with Serializable {
- def elemManifest = ClassManifest.Char
+ def elemTag = ClassTag.Char
def length: Int = array.length
def apply(index: Int): Char = array(index)
def update(index: Int, elem: Char) { array(index) = elem }
}
final class ofInt(val array: Array[Int]) extends WrappedArray[Int] with Serializable {
- def elemManifest = ClassManifest.Int
+ def elemTag = ClassTag.Int
def length: Int = array.length
def apply(index: Int): Int = array(index)
def update(index: Int, elem: Int) { array(index) = elem }
}
final class ofLong(val array: Array[Long]) extends WrappedArray[Long] with Serializable {
- def elemManifest = ClassManifest.Long
+ def elemTag = ClassTag.Long
def length: Int = array.length
def apply(index: Int): Long = array(index)
def update(index: Int, elem: Long) { array(index) = elem }
}
final class ofFloat(val array: Array[Float]) extends WrappedArray[Float] with Serializable {
- def elemManifest = ClassManifest.Float
+ def elemTag = ClassTag.Float
def length: Int = array.length
def apply(index: Int): Float = array(index)
def update(index: Int, elem: Float) { array(index) = elem }
}
final class ofDouble(val array: Array[Double]) extends WrappedArray[Double] with Serializable {
- def elemManifest = ClassManifest.Double
+ def elemTag = ClassTag.Double
def length: Int = array.length
def apply(index: Int): Double = array(index)
def update(index: Int, elem: Double) { array(index) = elem }
}
final class ofBoolean(val array: Array[Boolean]) extends WrappedArray[Boolean] with Serializable {
- def elemManifest = ClassManifest.Boolean
+ def elemTag = ClassTag.Boolean
def length: Int = array.length
def apply(index: Int): Boolean = array(index)
def update(index: Int, elem: Boolean) { array(index) = elem }
}
final class ofUnit(val array: Array[Unit]) extends WrappedArray[Unit] with Serializable {
- def elemManifest = ClassManifest.Unit
+ def elemTag = ClassTag.Unit
def length: Int = array.length
def apply(index: Int): Unit = array(index)
def update(index: Int, elem: Unit) { array(index) = elem }
diff --git a/src/library/scala/collection/mutable/WrappedArrayBuilder.scala b/src/library/scala/collection/mutable/WrappedArrayBuilder.scala
index fce65468e9..99a0b0ede3 100644
--- a/src/library/scala/collection/mutable/WrappedArrayBuilder.scala
+++ b/src/library/scala/collection/mutable/WrappedArrayBuilder.scala
@@ -12,23 +12,27 @@ package scala.collection
package mutable
import generic._
-import scala.reflect.ClassManifest
+import scala.reflect.ArrayTag
+import scala.runtime.ScalaRunTime._
/** A builder class for arrays.
*
- * @tparam A type of elements that can be added to this builder.
- * @param manifest class manifest for objects of type `A`.
+ * @tparam A type of elements that can be added to this builder.
+ * @param tag class tag for objects of type `A`.
*
* @since 2.8
*/
-class WrappedArrayBuilder[A](manifest: ClassManifest[A]) extends Builder[A, WrappedArray[A]] {
+class WrappedArrayBuilder[A](tag: ArrayTag[A]) extends Builder[A, WrappedArray[A]] {
+
+ @deprecated("use tag instead", "2.10.0")
+ val manifest: ArrayTag[A] = tag
private var elems: WrappedArray[A] = _
private var capacity: Int = 0
private var size: Int = 0
private def mkArray(size: Int): WrappedArray[A] = {
- val erasure = manifest.erasure
+ val erasure = arrayElementClass(tag)
val newelems = erasure match {
case java.lang.Byte.TYPE => new WrappedArray.ofByte(new Array[Byte](size)).asInstanceOf[WrappedArray[A]]
case java.lang.Short.TYPE => new WrappedArray.ofShort(new Array[Short](size)).asInstanceOf[WrappedArray[A]]
@@ -39,7 +43,7 @@ class WrappedArrayBuilder[A](manifest: ClassManifest[A]) extends Builder[A, Wrap
case java.lang.Double.TYPE => new WrappedArray.ofDouble(new Array[Double](size)).asInstanceOf[WrappedArray[A]]
case java.lang.Boolean.TYPE => new WrappedArray.ofBoolean(new Array[Boolean](size)).asInstanceOf[WrappedArray[A]]
case java.lang.Void.TYPE => new WrappedArray.ofUnit(new Array[Unit](size)).asInstanceOf[WrappedArray[A]]
- case _ => new WrappedArray.ofRef[A with AnyRef](manifest.newArray(size).asInstanceOf[Array[A with AnyRef]]).asInstanceOf[WrappedArray[A]]
+ case _ => new WrappedArray.ofRef[A with AnyRef](tag.newArray(size).asInstanceOf[Array[A with AnyRef]]).asInstanceOf[WrappedArray[A]]
}
if (this.size > 0) Array.copy(elems.array, 0, newelems.array, 0, this.size)
newelems
diff --git a/src/library/scala/collection/parallel/ParIterableLike.scala b/src/library/scala/collection/parallel/ParIterableLike.scala
index 5bf338f560..014b9b1a42 100644
--- a/src/library/scala/collection/parallel/ParIterableLike.scala
+++ b/src/library/scala/collection/parallel/ParIterableLike.scala
@@ -155,15 +155,15 @@ extends GenIterableLike[T, Repr]
with HasNewCombiner[T, Repr]
{
self: ParIterableLike[T, Repr, Sequential] =>
-
+
@transient
@volatile
private var _tasksupport = defaultTaskSupport
-
+
protected def initTaskSupport() {
_tasksupport = defaultTaskSupport
}
-
+
def tasksupport = {
val ts = _tasksupport
if (ts eq null) {
@@ -171,9 +171,9 @@ self: ParIterableLike[T, Repr, Sequential] =>
defaultTaskSupport
} else ts
}
-
+
def tasksupport_=(ts: TaskSupport) = _tasksupport = ts
-
+
def seq: Sequential
def repr: Repr = this.asInstanceOf[Repr]
@@ -240,7 +240,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
trait BuilderOps[Elem, To] {
trait Otherwise[Cmb] {
- def otherwise(notbody: => Unit)(implicit m: ClassManifest[Cmb]): Unit
+ def otherwise(notbody: => Unit)(implicit t: ClassTag[Cmb]): Unit
}
def ifIs[Cmb](isbody: Cmb => Unit): Otherwise[Cmb]
@@ -282,8 +282,8 @@ self: ParIterableLike[T, Repr, Sequential] =>
protected implicit def builder2ops[Elem, To](cb: Builder[Elem, To]) = new BuilderOps[Elem, To] {
def ifIs[Cmb](isbody: Cmb => Unit) = new Otherwise[Cmb] {
- def otherwise(notbody: => Unit)(implicit m: ClassManifest[Cmb]) {
- if (cb.getClass == m.erasure) isbody(cb.asInstanceOf[Cmb]) else notbody
+ def otherwise(notbody: => Unit)(implicit t: ClassTag[Cmb]) {
+ if (cb.getClass == t.erasure) isbody(cb.asInstanceOf[Cmb]) else notbody
}
}
def isCombiner = cb.isInstanceOf[Combiner[_, _]]
@@ -754,7 +754,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
cntx.setIndexFlag(Int.MaxValue)
tasksupport.executeAndWaitResult(
new Span(0, pred, combinerFactory, combinerFactory, splitter assign cntx) mapResult {
- _._2.resultWithTaskSupport
+ _._2.resultWithTaskSupport
}
)
}
@@ -802,7 +802,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
def size = splitter.remaining
}
- override def toArray[U >: T: ClassManifest]: Array[U] = {
+ override def toArray[U >: T: ArrayTag]: Array[U] = {
val arr = new Array[U](size)
copyToArray(arr)
arr
diff --git a/src/library/scala/collection/parallel/mutable/ParArray.scala b/src/library/scala/collection/parallel/mutable/ParArray.scala
index 8cc0b95997..92ba701f7c 100644
--- a/src/library/scala/collection/parallel/mutable/ParArray.scala
+++ b/src/library/scala/collection/parallel/mutable/ParArray.scala
@@ -676,7 +676,7 @@ self =>
private def readObject(in: java.io.ObjectInputStream) {
in.defaultReadObject
-
+
// get raw array from arrayseq
array = arrayseq.array.asInstanceOf[Array[Any]]
}
@@ -706,7 +706,7 @@ object ParArray extends ParFactory[ParArray] {
case _ => new ParArray[T](new ExposedArraySeq[T](runtime.ScalaRunTime.toObjectArray(arr), sz))
}
- def createFromCopy[T <: AnyRef : ClassManifest](arr: Array[T]): ParArray[T] = {
+ def createFromCopy[T <: AnyRef : ArrayTag](arr: Array[T]): ParArray[T] = {
val newarr = new Array[T](arr.length)
Array.copy(arr, 0, newarr, 0, arr.length)
handoff(newarr)
diff --git a/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala b/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala
index 410b542a68..43d40776bf 100644
--- a/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala
+++ b/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala
@@ -26,7 +26,7 @@ import scala.collection.parallel.Task
-private[mutable] class DoublingUnrolledBuffer[T](implicit m: ClassManifest[T]) extends UnrolledBuffer[T]()(m) {
+private[mutable] class DoublingUnrolledBuffer[T](implicit t: ArrayTag[T]) extends UnrolledBuffer[T]()(t) {
override def calcNextLength(sz: Int) = if (sz < 10000) sz * 2 else sz
protected override def newUnrolled = new Unrolled[T](0, new Array[T](4), null, this)
}
diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala
index 9aaf05dbd6..def086bc03 100644
--- a/src/library/scala/concurrent/Future.scala
+++ b/src/library/scala/concurrent/Future.scala
@@ -134,26 +134,26 @@ trait Future[+T] extends Awaitable[T] {
/** Creates a new promise.
*/
protected def newPromise[S]: Promise[S]
-
+
/** Returns whether the future has already been completed with
* a value or an exception.
- *
+ *
* $nonDeterministic
- *
+ *
* @return `true` if the future is already completed, `false` otherwise
*/
def isCompleted: Boolean
-
+
/** The value of this `Future`.
- *
+ *
* If the future is not completed the returned value will be `None`.
* If the future is completed the value will be `Some(Success(t))`
* if it contains a valid result, or `Some(Failure(error))` if it contains
* an exception.
*/
def value: Option[Either[Throwable, T]]
-
-
+
+
/* Projections */
/** Returns a failed projection of this future.
@@ -421,11 +421,11 @@ trait Future[+T] extends Awaitable[T] {
}
p.future
}
-
+
/** Creates a new `Future[S]` which is completed with this `Future`'s result if
* that conforms to `S`'s erased type or a `ClassCastException` otherwise.
*/
- def mapTo[S](implicit m: Manifest[S]): Future[S] = {
+ def mapTo[S](implicit tag: ClassTag[S]): Future[S] = {
import java.{ lang => jl }
val toBoxed = Map[Class[_], Class[_]](
classOf[Boolean] -> classOf[jl.Boolean],
@@ -444,20 +444,20 @@ trait Future[+T] extends Awaitable[T] {
}
val p = newPromise[S]
-
+
onComplete {
case l: Left[Throwable, _] => p complete l.asInstanceOf[Either[Throwable, S]]
case Right(t) =>
p complete (try {
- Right(boxedType(m.erasure).cast(t).asInstanceOf[S])
+ Right(boxedType(tag.erasure).cast(t).asInstanceOf[S])
} catch {
case e: ClassCastException => Left(e)
})
}
-
+
p.future
}
-
+
/** Applies the side-effecting function to the result of this future, and returns
* a new future with the result of this future.
*
@@ -591,7 +591,7 @@ object Future {
* The fold is performed on the thread where the last future is completed,
* the result will be the first failure of any of the futures, or any failure in the actual fold,
* or the result of the fold.
- *
+ *
* Example:
* {{{
* val result = Await.result(Future.fold(futures)(0)(_ + _), 5 seconds)
@@ -603,7 +603,7 @@ object Future {
}
/** Initiates a fold over the supplied futures where the fold-zero is the result value of the `Future` that's completed first.
- *
+ *
* Example:
* {{{
* val result = Await.result(Futures.reduce(futures)(_ + _), 5 seconds)
@@ -613,11 +613,11 @@ object Future {
if (futures.isEmpty) Promise[R].failure(new NoSuchElementException("reduce attempted on empty collection")).future
else sequence(futures).map(_ reduceLeft op)
}
-
+
/** Transforms a `Traversable[A]` into a `Future[Traversable[B]]` using the provided function `A => Future[B]`.
* This is useful for performing a parallel map. For example, to apply a function to all items of a list
* in parallel:
- *
+ *
* {{{
* val myFutureList = Future.traverse(myList)(x => Future(myFunc(x)))
* }}}
@@ -627,7 +627,7 @@ object Future {
val fb = fn(a.asInstanceOf[A])
for (r <- fr; b <- fb) yield (r += b)
}.map(_.result)
-
+
}
diff --git a/src/library/scala/reflect/DummyMirror.scala b/src/library/scala/reflect/DummyMirror.scala
index 8b2ddde2a1..276237fce4 100644
--- a/src/library/scala/reflect/DummyMirror.scala
+++ b/src/library/scala/reflect/DummyMirror.scala
@@ -5,9 +5,10 @@ import scala.reflect.api.Attachment
import scala.reflect.api.Modifier
import scala.reflect.api.Universe
+// todo. make Dummy objects not equal to themselves
class DummyMirror(cl: ClassLoader) extends api.Mirror {
// Members declared in scala.reflect.api.AnnotationInfos
- implicit def classfileAnnotArgManifest: scala.reflect.ClassManifest[ClassfileAnnotArg] = notSupported()
+ implicit def classfileAnnotArgTag: scala.reflect.ClassTag[ClassfileAnnotArg] = notSupported()
type AnnotationInfo = DummyAnnotationInfo.type
object DummyAnnotationInfo
val AnnotationInfo: AnnotationInfoExtractor = DummyAnnotationInfoExtractor
diff --git a/src/library/scala/reflect/api/AnnotationInfos.scala b/src/library/scala/reflect/api/AnnotationInfos.scala
index 96a65606e5..cc1c4d2b6b 100755
--- a/src/library/scala/reflect/api/AnnotationInfos.scala
+++ b/src/library/scala/reflect/api/AnnotationInfos.scala
@@ -12,7 +12,7 @@ trait AnnotationInfos { self: Universe =>
}
type ClassfileAnnotArg <: AnyRef
- implicit def classfileAnnotArgManifest: ClassManifest[ClassfileAnnotArg] // need a precise manifest to pass to UnPickle's toArray call
+ implicit def classfileAnnotArgTag: ArrayTag[ClassfileAnnotArg] // need a precise tag to pass to UnPickle's toArray call
type LiteralAnnotArg <: ClassfileAnnotArg
val LiteralAnnotArg: LiteralAnnotArgExtractor
diff --git a/src/library/scala/util/Marshal.scala b/src/library/scala/util/Marshal.scala
index 6eb58e8570..e2ebe7851c 100644
--- a/src/library/scala/util/Marshal.scala
+++ b/src/library/scala/util/Marshal.scala
@@ -48,4 +48,4 @@ object Marshal {
"\n required: "+expected)
}
}
-} \ No newline at end of file
+}
diff --git a/src/library/scala/util/Sorting.scala b/src/library/scala/util/Sorting.scala
index bf460a118f..7d98e57741 100644
--- a/src/library/scala/util/Sorting.scala
+++ b/src/library/scala/util/Sorting.scala
@@ -8,7 +8,7 @@
package scala.util
-import scala.reflect.ClassManifest
+import scala.reflect.ClassTag
import scala.math.Ordering
/** The Sorting object provides functions that can sort various kinds of
@@ -39,14 +39,14 @@ object Sorting {
/** Sort an array of K where K is Ordered, preserving the existing order
* where the values are equal. */
- def stableSort[K: ClassManifest: Ordering](a: Array[K]) {
+ def stableSort[K: ArrayTag: Ordering](a: Array[K]) {
stableSort(a, 0, a.length-1, new Array[K](a.length), Ordering[K].lt _)
}
/** Sorts an array of `K` given an ordering function `f`.
* `f` should return `true` iff its first parameter is strictly less than its second parameter.
*/
- def stableSort[K: ClassManifest](a: Array[K], f: (K, K) => Boolean) {
+ def stableSort[K: ArrayTag](a: Array[K], f: (K, K) => Boolean) {
stableSort(a, 0, a.length-1, new Array[K](a.length), f)
}
@@ -57,14 +57,14 @@ object Sorting {
* @param f the comparison function.
* @return the sorted sequence of items.
*/
- def stableSort[K: ClassManifest](a: Seq[K], f: (K, K) => Boolean): Array[K] = {
+ def stableSort[K: ArrayTag](a: Seq[K], f: (K, K) => Boolean): Array[K] = {
val ret = a.toArray
stableSort(ret, f)
ret
}
/** Sorts an arbitrary sequence of items that are viewable as ordered. */
- def stableSort[K: ClassManifest: Ordering](a: Seq[K]): Array[K] =
+ def stableSort[K: ArrayTag: Ordering](a: Seq[K]): Array[K] =
stableSort(a, Ordering[K].lt _)
/** Stably sorts a sequence of items given an extraction function that will
@@ -74,8 +74,8 @@ object Sorting {
* @param f the comparison function.
* @return the sorted sequence of items.
*/
- def stableSort[K: ClassManifest, M: Ordering](a: Seq[K], f: K => M): Array[K] =
- stableSort(a)(implicitly[ClassManifest[K]], Ordering[M] on f)
+ def stableSort[K: ArrayTag, M: Ordering](a: Seq[K], f: K => M): Array[K] =
+ stableSort(a)(implicitly[ArrayTag[K]], Ordering[M] on f)
private def sort1[K: Ordering](x: Array[K], off: Int, len: Int) {
val ord = Ordering[K]
@@ -498,7 +498,7 @@ object Sorting {
sort2(off, len)
}
- private def stableSort[K : ClassManifest](a: Array[K], lo: Int, hi: Int, scratch: Array[K], f: (K,K) => Boolean) {
+ private def stableSort[K : ArrayTag](a: Array[K], lo: Int, hi: Int, scratch: Array[K], f: (K,K) => Boolean) {
if (lo < hi) {
val mid = (lo+hi) / 2
stableSort(a, lo, mid, scratch, f)
diff --git a/src/library/scala/util/control/Exception.scala b/src/library/scala/util/control/Exception.scala
index 1cae8088f5..38f4abb20a 100644
--- a/src/library/scala/util/control/Exception.scala
+++ b/src/library/scala/util/control/Exception.scala
@@ -30,9 +30,9 @@ import language.implicitConversions
object Exception {
type Catcher[+T] = PartialFunction[Throwable, T]
- def mkCatcher[Ex <: Throwable: ClassManifest, T](isDef: Ex => Boolean, f: Ex => T) = new Catcher[T] {
+ def mkCatcher[Ex <: Throwable: ClassTag, T](isDef: Ex => Boolean, f: Ex => T) = new Catcher[T] {
private def downcast(x: Throwable): Option[Ex] =
- if (classManifest[Ex].erasure.isAssignableFrom(x.getClass)) Some(x.asInstanceOf[Ex])
+ if (classTag[Ex].erasure.isAssignableFrom(x.getClass)) Some(x.asInstanceOf[Ex])
else None
def isDefinedAt(x: Throwable) = downcast(x) exists isDef
@@ -41,7 +41,7 @@ object Exception {
def mkThrowableCatcher[T](isDef: Throwable => Boolean, f: Throwable => T) = mkCatcher(isDef, f)
- implicit def throwableSubtypeToCatcher[Ex <: Throwable: ClassManifest, T](pf: PartialFunction[Ex, T]) =
+ implicit def throwableSubtypeToCatcher[Ex <: Throwable: ClassTag, T](pf: PartialFunction[Ex, T]) =
mkCatcher(pf.isDefinedAt _, pf.apply _)
/** !!! Not at all sure of every factor which goes into this,
diff --git a/src/partest/scala/tools/partest/CompilerTest.scala b/src/partest/scala/tools/partest/CompilerTest.scala
index aaea4416dd..86678760be 100644
--- a/src/partest/scala/tools/partest/CompilerTest.scala
+++ b/src/partest/scala/tools/partest/CompilerTest.scala
@@ -5,6 +5,7 @@
package scala.tools.partest
+import scala.reflect.{mirror => rm}
import scala.tools.nsc._
/** For testing compiler internals directly.
@@ -29,13 +30,13 @@ abstract class CompilerTest extends DirectTest {
// Override at least one of these...
def code = ""
def sources: List[String] = List(code)
-
+
// Utility functions
-
+
class MkType(sym: Symbol) {
- def apply[M](implicit m1: Manifest[M]): Type =
+ def apply[M](implicit t: rm.TypeTag[M]): Type =
if (sym eq NoSymbol) NoType
- else appliedType(sym, manifestToType(m1))
+ else appliedType(sym, compilerTypeFromTag(t))
}
implicit def mkMkType(sym: Symbol) = new MkType(sym)
@@ -47,7 +48,7 @@ abstract class CompilerTest extends DirectTest {
}
loop(Set(), List(root))
}
-
+
class SymsInPackage(pkgName: String) {
def pkg = getRequiredModule(pkgName)
def classes = allMembers(pkg) filter (_.isClass)
diff --git a/src/partest/scala/tools/partest/SigTest.scala b/src/partest/scala/tools/partest/SigTest.scala
index 072ec006f9..999d901d21 100644
--- a/src/partest/scala/tools/partest/SigTest.scala
+++ b/src/partest/scala/tools/partest/SigTest.scala
@@ -20,31 +20,31 @@ trait SigTest {
def isObjectMethodName(name: String) = classOf[Object].getMethods exists (_.getName == name)
- def fields[T: ClassManifest](p: JField => Boolean) = {
- val cl = classManifest[T].erasure
+ def fields[T: ClassTag](p: JField => Boolean) = {
+ val cl = classTag[T].erasure
val fs = (cl.getFields ++ cl.getDeclaredFields).distinct sortBy (_.getName)
fs filter p
}
- def methods[T: ClassManifest](p: JMethod => Boolean) = {
- val cl = classManifest[T].erasure
+ def methods[T: ClassTag](p: JMethod => Boolean) = {
+ val cl = classTag[T].erasure
val ms = (cl.getMethods ++ cl.getDeclaredMethods).distinct sortBy (x => (x.getName, x.isBridge))
ms filter p
}
- def allFields[T: ClassManifest]() = fields[T](_ => true)
- def allMethods[T: ClassManifest]() = methods[T](m => !isObjectMethodName(m.getName))
- def fieldsNamed[T: ClassManifest](name: String) = fields[T](_.getName == name)
- def methodsNamed[T: ClassManifest](name: String) = methods[T](_.getName == name)
+ def allFields[T: ClassTag]() = fields[T](_ => true)
+ def allMethods[T: ClassTag]() = methods[T](m => !isObjectMethodName(m.getName))
+ def fieldsNamed[T: ClassTag](name: String) = fields[T](_.getName == name)
+ def methodsNamed[T: ClassTag](name: String) = methods[T](_.getName == name)
- def allGenericStrings[T: ClassManifest]() =
+ def allGenericStrings[T: ClassTag]() =
(allMethods[T]() map mstr) ++ (allFields[T]() map fstr)
- def genericStrings[T: ClassManifest](name: String) =
+ def genericStrings[T: ClassTag](name: String) =
(methodsNamed[T](name) map mstr) ++ (fieldsNamed[T](name) map fstr)
- def show[T: ClassManifest](name: String = "") = {
- println(classManifest[T].erasure.getName)
+ def show[T: ClassTag](name: String = "") = {
+ println(classTag[T].erasure.getName)
if (name == "") allGenericStrings[T]() foreach println
else genericStrings[T](name) foreach println
}
diff --git a/src/scalacheck/org/scalacheck/Arbitrary.scala b/src/scalacheck/org/scalacheck/Arbitrary.scala
index 91d56b0aec..9bb235f917 100644
--- a/src/scalacheck/org/scalacheck/Arbitrary.scala
+++ b/src/scalacheck/org/scalacheck/Arbitrary.scala
@@ -263,7 +263,7 @@ object Arbitrary {
): Arbitrary[C[T]] = Arbitrary(containerOf[C,T](arbitrary[T]))
/** Arbitrary instance of any array. */
- implicit def arbArray[T](implicit a: Arbitrary[T], c: ClassManifest[T]
+ implicit def arbArray[T](implicit a: Arbitrary[T], c: ClassTag[T]
): Arbitrary[Array[T]] = Arbitrary(containerOf[Array,T](arbitrary[T]))
diff --git a/src/scalacheck/org/scalacheck/util/Buildable.scala b/src/scalacheck/org/scalacheck/util/Buildable.scala
index 6378e72d4f..662bc6146b 100644
--- a/src/scalacheck/org/scalacheck/util/Buildable.scala
+++ b/src/scalacheck/org/scalacheck/util/Buildable.scala
@@ -30,7 +30,7 @@ object Buildable {
def builder = (new mutable.ListBuffer[T]).mapResult(_.toStream)
}
- implicit def buildableArray[T](implicit cm: ClassManifest[T]) =
+ implicit def buildableArray[T](implicit t: ClassTag[T]) =
new Buildable[T,Array] {
def builder = mutable.ArrayBuilder.make[T]
}
diff --git a/src/swing/scala/swing/Font.scala.disabled b/src/swing/scala/swing/Font.scala.disabled
index 6eebd667bd..9e21eb859c 100644
--- a/src/swing/scala/swing/Font.scala.disabled
+++ b/src/swing/scala/swing/Font.scala.disabled
@@ -1,36 +1,36 @@
package scala.swing
-/*object Font {
- def apply(fontFormat: Int, fontFile: java.io.File) = java.awt.Font.createFont(fontFormat, fontFile)
- def apply(fontFormat: Int, fontStream: java.io.InputStream) = java.awt.Font.createFont(fontFormat, fontStream)
+/*object Font {
+ def apply(fontFormat: Int, fontFile: java.io.File) = java.awt.Font.createFont(fontFormat, fontFile)
+ def apply(fontFormat: Int, fontStream: java.io.InputStream) = java.awt.Font.createFont(fontFormat, fontStream)
def decode(str: String) = java.awt.Font.decode(str)
-
+
/* TODO: finish implementation
/**
* See [java.awt.Font.getFont].
*/
- def get(attributes: Map[_ <: java.text.AttributedCharacterIterator.Attribute, _]) =
+ def get(attributes: Map[_ <: java.text.AttributedCharacterIterator.Attribute, _]) =
java.awt.Font.getFont(ImmutableMapWrapper(attributes))
-
+
import java.{util => ju}
- private case class ImmutableMapWrapper[A, B](underlying : Map[A, B])(m : ClassManifest[A]) extends ju.AbstractMap[A, B] {
+ private case class ImmutableMapWrapper[A, B](underlying : Map[A, B])(t : ClassTag[A]) extends ju.AbstractMap[A, B] {
self =>
override def size = underlying.size
- override def put(k : A, v : B) =
+ override def put(k : A, v : B) =
throw new UnsupportedOperationException("This is a wrapper that does not support mutation")
- override def remove(k : AnyRef) =
+ override def remove(k : AnyRef) =
throw new UnsupportedOperationException("This is a wrapper that does not support mutation")
-
+
override def entrySet : ju.Set[ju.Map.Entry[A, B]] = new ju.AbstractSet[ju.Map.Entry[A, B]] {
def size = self.size
def iterator = new ju.Iterator[ju.Map.Entry[A, B]] {
val ui = underlying.iterator
var prev : Option[A] = None
-
+
def hasNext = ui.hasNext
-
+
def next = {
val (k, v) = ui.next
prev = Some(k)
@@ -44,7 +44,7 @@ package scala.swing
}
}
}
-
+
def remove = prev match {
case Some(k) => val v = self.remove(k.asInstanceOf[AnyRef]) ; prev = None ; v
case _ => throw new IllegalStateException("next must be called at least once before remove")
@@ -53,7 +53,7 @@ package scala.swing
}
}
*/
-
+
/**
* See [java.awt.Font.getFont].
*/
@@ -62,9 +62,9 @@ package scala.swing
* See [java.awt.Font.getFont].
*/
def get(nm: String, font: Font) = java.awt.Font.getFont(nm, font)
-
+
def Insets(x: Int, y: Int, width: Int, height: Int) = new Insets(x, y, width, height)
def Rectangle(x: Int, y: Int, width: Int, height: Int) = new Insets(x, y, width, height)
def Point(x: Int, y: Int) = new Point(x, y)
- def Dimension(x: Int, y: Int) = new Dimension(x, y)
+ def Dimension(x: Int, y: Int) = new Dimension(x, y)
}*/ \ No newline at end of file
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
}
-