summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-03-31 19:26:24 +0000
committerPaul Phillips <paulp@improving.org>2011-03-31 19:26:24 +0000
commit661ce2922df999d70da29ee3910bf2dcf851eb66 (patch)
treeffb1cf041a6af20668c844d1ffd4b88f94ee6357 /src/compiler
parentb1cb4e114f6a3291ad2fdfbd12fa91193f885941 (diff)
downloadscala-661ce2922df999d70da29ee3910bf2dcf851eb66.tar.gz
scala-661ce2922df999d70da29ee3910bf2dcf851eb66.tar.bz2
scala-661ce2922df999d70da29ee3910bf2dcf851eb66.zip
Printing refinement types in scaladoc.
one-member refinements, for bigger ones printing the number of members. Should be improved. Closes #484, no review.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
index 5d7b1d1214..4edfa83a0d 100644
--- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -596,8 +596,14 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
/* Refined types */
case RefinedType(parents, defs) =>
appendTypes0((if (parents.length > 1) parents filterNot (_ == ObjectClass.tpe) else parents), " with ")
- if (!defs.isEmpty) {
- nameBuffer append " {...}" // TODO: actually print the refinement
+ // XXX Still todo: properly printing refinements.
+ // Since I didn't know how to go about displaying a multi-line type, I went with
+ // printing single method refinements (which should be the most common) and printing
+ // the number of members if there are more.
+ defs.toList match {
+ case Nil => ()
+ case x :: Nil => nameBuffer append (" { " + x.defString + " }")
+ case xs => nameBuffer append (" { ... /* %d definitions in type refinement */ }" format xs.size)
}
/* Eval-by-name types */
case NullaryMethodType(result) =>