summaryrefslogtreecommitdiff
path: root/test/files/run/reflection-tags.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-27 22:47:36 +0300
committerEugene Burmako <xeno.by@gmail.com>2014-02-14 13:24:48 +0100
commitad7983b70a43ba9033a491c00ad22691e7a0a7b4 (patch)
treefded601a5fa3c4d7cea23d742e30e15f1ace7404 /test/files/run/reflection-tags.scala
parent3293d60531615f4accdee886fba52ddda0929b31 (diff)
downloadscala-ad7983b70a43ba9033a491c00ad22691e7a0a7b4.tar.gz
scala-ad7983b70a43ba9033a491c00ad22691e7a0a7b4.tar.bz2
scala-ad7983b70a43ba9033a491c00ad22691e7a0a7b4.zip
additional class tags for reflection API
Introduces a test that iterates all abstract types in reflection API and makes sure that every one of them has an associated class tag. After being introduced, the test has immediately failed exposing the lack of tags for TreeCopier, Mirror and RuntimeClass, which has been subsequently fixed in this commit.
Diffstat (limited to 'test/files/run/reflection-tags.scala')
-rw-r--r--test/files/run/reflection-tags.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/run/reflection-tags.scala b/test/files/run/reflection-tags.scala
new file mode 100644
index 0000000000..fba90f61e9
--- /dev/null
+++ b/test/files/run/reflection-tags.scala
@@ -0,0 +1,17 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+object Test extends App {
+ var typeMembers = typeOf[scala.reflect.api.Universe].members.filter(sym => sym.isType && !sym.isClass).toList
+ typeMembers = typeMembers.filter(_.name != TypeName("ModifiersCreator")) // type ModifiersCreator = ModifiersExtractor
+ val tags = typeOf[scala.reflect.api.Universe].members.filter(sym => sym.isImplicit).toList
+
+ typeMembers.foreach(_.typeSignature)
+ tags.foreach(_.typeSignature)
+
+ val outliers = typeMembers.filter(tm => !tags.exists(tag => tag.typeSignature match {
+ case NullaryMethodType(TypeRef(_, sym, targ :: Nil)) => sym == typeOf[ClassTag[_]].typeSymbol && targ.typeSymbol == tm
+ case _ => false
+ }))
+ println(outliers)
+} \ No newline at end of file