diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-29 14:20:21 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-29 15:01:57 -0700 |
commit | 29a59700b4cf1ade91abb6020ba4814be5ef88e7 (patch) | |
tree | 72e08ca9fed178bc4166ea00c1521b4d7b4a7975 /src/reflect/scala/reflect/internal/Symbols.scala | |
parent | 2e14b0771569b4fb6cd0273e1480f69c18743832 (diff) | |
download | scala-29a59700b4cf1ade91abb6020ba4814be5ef88e7.tar.gz scala-29a59700b4cf1ade91abb6020ba4814be5ef88e7.tar.bz2 scala-29a59700b4cf1ade91abb6020ba4814be5ef88e7.zip |
Added utility function shortClass.
Pretty sick of names like
scala> typeOf[List[Int]].getClass.getName
res0: String = scala.reflect.internal.Types$TypeRef$$anon$1
I wrote this so I can see what the class of some arbitrary
thing is in a way which my little brain can understand. For
the example above we get
scala> shortClassOfInstance(typeOf[List[Int]])
res0: String = ArgsTypeRef with AliasTypeRef
Let's pimp a "shortClassName" onto AnyRef and be happy.
Diffstat (limited to 'src/reflect/scala/reflect/internal/Symbols.scala')
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 3adcd86c73..c0d15450e9 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -8,7 +8,7 @@ package internal import scala.collection.{ mutable, immutable } import scala.collection.mutable.ListBuffer -import util.Statistics +import util.{ Statistics, shortClassOfInstance } import Flags._ import scala.annotation.tailrec import scala.reflect.io.AbstractFile @@ -182,7 +182,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => if (isGADTSkolem) " (this is a GADT skolem)" else "" - def shortSymbolClass = getClass.getName.split('.').last.stripPrefix("Symbols$") + def shortSymbolClass = shortClassOfInstance(this) def symbolCreationString: String = ( "%s%25s | %-40s | %s".format( if (settings.uniqid.value) "%06d | ".format(id) else "", |