diff options
author | Paul Phillips <paulp@improving.org> | 2009-03-16 17:46:58 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-03-16 17:46:58 +0000 |
commit | 67c3c68da5de6284c5e37ef4b5f907d0079f0490 (patch) | |
tree | 0db5a40f781f2f9edb21fd4c20ce6608c8a5c147 /src/library/scalax/collection/immutable/Stream.scala | |
parent | 00d196adeeb3aa88f2afedcb5d7eb51f0fc19896 (diff) | |
download | scala-67c3c68da5de6284c5e37ef4b5f907d0079f0490.tar.gz scala-67c3c68da5de6284c5e37ef4b5f907d0079f0490.tar.bz2 scala-67c3c68da5de6284c5e37ef4b5f907d0079f0490.zip |
The birth of the @switch and @tailrec annotations.
They are located in package scala.annotation. Also in this patch:
* numerous test cases for both annotations
* addition of @tailrec and @switch in a few strategic locations
* fixes for critical section NewScanners methods which were not being
compiled into switches, immediately proving the value of @switch
* tail recursive implementations for Iterator.{ dropWhile, drop}
and List.dropWhile tagged with @tailrec, closing bug #1376
Diffstat (limited to 'src/library/scalax/collection/immutable/Stream.scala')
-rwxr-xr-x | src/library/scalax/collection/immutable/Stream.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/library/scalax/collection/immutable/Stream.scala b/src/library/scalax/collection/immutable/Stream.scala index 036fefe70c..4055be40bc 100755 --- a/src/library/scalax/collection/immutable/Stream.scala +++ b/src/library/scalax/collection/immutable/Stream.scala @@ -14,6 +14,7 @@ package scalax.collection.immutable import mutable.ListBuffer import generic.{SequenceTemplate, SequenceFactory, EmptyIterableFactory, Builder, LazyBuilder} import annotation.unchecked.uncheckedVariance +import annotation.tailrec /** * The object <code>Stream</code> provides helper functions @@ -486,6 +487,7 @@ self => * @param sep The separator string printed between consecutive elements. */ def print(sep: String) { + @tailrec def loop(these: Stream[A], start: String) { Console.print(start) if (isEmpty) Console.print("empty") |