summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-12-01 10:21:21 +0000
committerpaltherr <paltherr@epfl.ch>2003-12-01 10:21:21 +0000
commited0a728933064567fc9db1712b78a2fe2a5db073 (patch)
tree1d6f241a2898494844f2ed63b7b5bc7192471f74 /sources
parent44f38bde65961d019bb70d7f969dee66c9248b27 (diff)
downloadscala-ed0a728933064567fc9db1712b78a2fe2a5db073.tar.gz
scala-ed0a728933064567fc9db1712b78a2fe2a5db073.tar.bz2
scala-ed0a728933064567fc9db1712b78a2fe2a5db073.zip
- Added some code to avoid printing bounds like...
- Added some code to avoid printing bounds like <: Any and >: All
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala17
-rw-r--r--sources/scalac/ast/printer/TextTreePrinter.java13
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);
}
}