diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-04-23 16:04:56 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-04-23 17:54:50 +0200 |
commit | 0f0144c74088e396fc1440166bed5a7c6d5f44f4 (patch) | |
tree | fd7cc379f1926a3e6a0b94ccb22dd071384cdeb1 /src/partest | |
parent | 2b09d8caf5497c4e016a3e1179e5f7e842766176 (diff) | |
download | scala-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
Diffstat (limited to 'src/partest')
-rw-r--r-- | src/partest/scala/tools/partest/CompilerTest.scala | 11 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/SigTest.scala | 24 |
2 files changed, 18 insertions, 17 deletions
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 } |