diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-12-02 22:52:49 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-12-12 15:06:22 +0100 |
commit | b2b9cf4f8c8ff8a00d19aabd56f0602c2aced4b3 (patch) | |
tree | 1e877fe065c1f3730e33e254678c1a95b5948d33 /src/reflect | |
parent | e6cee2627555f379ef6cd8cd554a1079a7e074aa (diff) | |
download | scala-b2b9cf4f8c8ff8a00d19aabd56f0602c2aced4b3.tar.gz scala-b2b9cf4f8c8ff8a00d19aabd56f0602c2aced4b3.tar.bz2 scala-b2b9cf4f8c8ff8a00d19aabd56f0602c2aced4b3.zip |
SI-8024 Improve user-level toString of package objects
We were outputing a the unattractive `package package`;
now we opt for `package object pack`.
Under `-Ydebug`, we still go to the "accurate" mode of the
old `toString` implementation, which differentiates package objects
vs package object classes.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 85bc3158f6..5705f8484a 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -2475,10 +2475,14 @@ trait Symbols extends api.Symbols { self: SymbolTable => /** String representation, including symbol's kind e.g., "class Foo", "method Bar". * If hasMeaninglessName is true, uses the owner's name to disambiguate identity. */ - override def toString: String = compose( - kindString, - if (hasMeaninglessName) owner.decodedName + idString else nameString - ) + override def toString: String = { + if (isPackageObjectOrClass && !settings.debug) + s"package object ${owner.decodedName}" + else compose( + kindString, + if (hasMeaninglessName) owner.decodedName + idString else nameString + ) + } /** String representation of location. */ |