diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/DocGenerator.scala | 41 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/ImmutableIterator.scala | 34 |
2 files changed, 49 insertions, 26 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala index 744e9f9a45..190eb2bbda 100644 --- a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala +++ b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala @@ -107,21 +107,36 @@ abstract class DocGenerator extends Models { if (definitions.isFunctionType(tpe)) { val (ts, List(r)) = tpe.typeArgs.splitAt(n-1) Text("(") ++ ( - if (ts.isEmpty) NodeSeq.Empty - else - urlFor(ts.head, target) ++ ( - for (val t <- ts.tail) - yield Group(Text(", ") ++ (urlFor(t, target))))) - .++ (Text(") => ")) ++ (urlFor(r, target)) + if (ts.isEmpty) NodeSeq.Empty + else + urlFor(ts.head, target) ++ { + val sep = Text(", ") + for (val t <- ts.tail) + yield Group(sep ++ urlFor(t, target)) + } + ) + .++ (Text(") => ")) ++ (urlFor(r, target)) } else aref(urlFor(tpe.symbol), target, tpe.symbol.fullNameString) - .++ (Text("[") ++ (urlFor(tpe.typeArgs.head, target)) - .++ ( - for (val t <- tpe.typeArgs.tail) - yield Group(Text(", ") ++ (urlFor(t, target)))) - .++(Text("]"))) - } else - aref(urlFor(tpe.symbol), target, tpe.toString()) + .++ (Text("[") ++ urlFor(tpe.typeArgs.head, target) + .++ { + val sep = Text(", ") + for (val t <- tpe.typeArgs.tail) + yield Group(sep ++ urlFor(t, target)) + } + .++ (Text("]"))) + } else tpe match { + case RefinedType(parents, _) => + assert(parents.length > 1) + aref(urlFor(parents(1).symbol), target, parents(1).toString()) + .++ { + val sep = Text(" with ") + for (val t <- parents.tail.tail) + yield Group(sep ++ urlFor(t, target)) + } + case _ => + aref(urlFor(tpe.symbol), target, tpe.toString()) + } } } catch { case e: Error => diff --git a/src/library/scala/collection/immutable/ImmutableIterator.scala b/src/library/scala/collection/immutable/ImmutableIterator.scala index 151e0726aa..dba7673e22 100644 --- a/src/library/scala/collection/immutable/ImmutableIterator.scala +++ b/src/library/scala/collection/immutable/ImmutableIterator.scala @@ -6,9 +6,10 @@ ** |/ ** \* */ -package scala.collection.immutable; // $Id$ +package scala.collection.immutable + /** An object for creating immutable iterators. */ object ImmutableIterator { @@ -23,16 +24,21 @@ object ImmutableIterator { } /** Creates an empty immutable iterator. - */ - def empty : ImmutableIterator[Nothing] = Empty; + */ + def empty : ImmutableIterator[Nothing] = Empty + /** Creates an immutable iterator with one element. - */ - def apply[A](item : A) : ImmutableIterator[A] = NonEmpty(item, () => Empty); + */ + def apply[A](item : A) : ImmutableIterator[A] = NonEmpty(item, () => Empty) + /** Prepends a lazy immutable iterator (right) with an element (item). - */ - def apply[A](item : A, right : () => ImmutableIterator[A]) : () => ImmutableIterator[A] = () => NonEmpty(item, right); - /** Appends an immutable iterator (left) with an element (item) followed by a lazy immutable iterator (right). - */ + */ + def apply[A](item : A, right : () => ImmutableIterator[A]) : () => ImmutableIterator[A] = + () => NonEmpty(item, right) + + /** Appends an immutable iterator (left) with an element (item) followed + * by a lazy immutable iterator (right). + */ def apply[A](left : ImmutableIterator[A], item : A, right : () => ImmutableIterator[A]) : ImmutableIterator[A] = left match { case NonEmpty(first, middle) => val rest = NonEmpty(item,right); @@ -55,12 +61,14 @@ object ImmutableIterator { * @version 1.0 */ sealed abstract class ImmutableIterator[+A] { + /** queries if this iterator has an element to return. - */ - def hasNext : Boolean; + */ + def hasNext: Boolean + /** returns the next element and immutable iterator as a pair. - */ - def next : Tuple2[A,ImmutableIterator[A]] + */ + def next: Tuple2[A,ImmutableIterator[A]] /** Creates a new immutable iterator that appends item to this immutable * iterator. |