diff options
-rw-r--r-- | sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala | 17 | ||||
-rw-r--r-- | sources/scalac/ast/printer/TextTreePrinter.java | 13 |
2 files changed, 22 insertions, 8 deletions
diff --git a/sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala b/sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala index 842bb82cf2..14d2fb3d0f 100644 --- a/sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala +++ b/sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala @@ -702,10 +702,19 @@ class TextTreePrinter(_out: PrintWriter, autoFlush: boolean) with TreePrinter { } protected def printBounds(lobound: Tree, hibound: Tree): unit = { - if (!"scala.All".equals(lobound.toString())) - printOpt(TXT_SUPERTYPE, lobound, true); - if (!"scala.Any".equals(hibound.toString())) - printOpt(TXT_SUBTYPE, hibound, true); + val definitions: Definitions = scalac_Global.instance.definitions; + val printLoBound: Boolean = + if (lobound.getType() != null) + lobound.getType().symbol() != definitions.ALL_CLASS + else + !"scala.All".equals(lobound.toString()); + if (printLoBound) printOpt(TXT_SUPERTYPE, lobound, true); + val printHiBound: Boolean = + if (hibound.getType() != null) + hibound.getType().symbol() != definitions.ANY_CLASS + else + !"scala.Any".equals(hibound.toString()); + if (printHiBound) printOpt(TXT_SUBTYPE, hibound, true); } } } diff --git a/sources/scalac/ast/printer/TextTreePrinter.java b/sources/scalac/ast/printer/TextTreePrinter.java index f4aa3cc6ff..9e71518f23 100644 --- a/sources/scalac/ast/printer/TextTreePrinter.java +++ b/sources/scalac/ast/printer/TextTreePrinter.java @@ -808,10 +808,15 @@ public class TextTreePrinter implements TreePrinter { } protected void printBounds(Tree lobound, Tree hibound) { - if (!"scala.All".equals(lobound.toString())) - printOpt(TXT_SUPERTYPE, lobound, true); - if (!"scala.Any".equals(hibound.toString())) - printOpt(TXT_SUBTYPE, hibound, true); + Definitions definitions = Global.instance.definitions; + boolean printLoBound = lobound.type != null + ? lobound.type().symbol() != definitions.ALL_CLASS + : !"scala.All".equals(lobound.toString()); + if (printLoBound) printOpt(TXT_SUPERTYPE, lobound, true); + boolean printHiBound = hibound.type != null + ? hibound.type().symbol() != definitions.ANY_CLASS + : !"scala.Any".equals(hibound.toString()); + if (printHiBound) printOpt(TXT_SUBTYPE, hibound, true); } } |