@@ -592,15 +592,15 @@ final class LazyListIterable[+A] private(@untrackedCaptures lazyState: () => Laz
592592 */
593593 // optimisations are not for speed, but for functionality
594594 // see tickets #153, #498, #2147, and corresponding tests in run/ (as well as run/stream_flatmap_odds.scala)
595- override def flatMap [B ](f : A => IterableOnce [B ]^ ): LazyListIterable [B ]^ {this , f} =
595+ override def flatMap [B ](f : A => IterableOnce [B ]^ ): LazyListIterable [B ]^ {this , f* } =
596596 if (knownIsEmpty) LazyListIterable .empty
597597 else LazyListIterable .flatMapImpl(this , f)
598598
599599 /** @inheritdoc
600600 *
601601 * $preservesLaziness
602602 */
603- override def flatten [B ](implicit asIterable : A -> IterableOnce [B ]): LazyListIterable [B ]^ {this } = flatMap(asIterable)
603+ override def flatten [B ](implicit asIterable : A -> IterableOnce [B ]): LazyListIterable [B ]^ {this , asIterable * } = flatMap(asIterable)
604604
605605 /** @inheritdoc
606606 *
@@ -1061,11 +1061,11 @@ object LazyListIterable extends IterableFactory[LazyListIterable] {
10611061 }
10621062 }
10631063
1064- private def flatMapImpl [A , B ](ll : LazyListIterable [A ]^ , f : A => IterableOnce [B ]^ ): LazyListIterable [B ]^ {ll, f} = {
1064+ private def flatMapImpl [A , B ](ll : LazyListIterable [A ]^ , f : A => IterableOnce [B ]^ ): LazyListIterable [B ]^ {ll, f* } = {
10651065 // DO NOT REFERENCE `ll` ANYWHERE ELSE, OR IT WILL LEAK THE HEAD
10661066 var restRef : LazyListIterable [A ]^ {ll} = ll // restRef is captured by closure arg to newLL, so A is not recognized as parametric
10671067 newLL {
1068- var it : Iterator [B ]^ {ll, f} = null
1068+ var it : Iterator [B ]^ {ll, f* } = null
10691069 var itHasNext = false
10701070 var rest = restRef // var rest = restRef.elem
10711071 while (! itHasNext && ! rest.isEmpty) {
@@ -1185,7 +1185,7 @@ object LazyListIterable extends IterableFactory[LazyListIterable] {
11851185 /** Creates a State from an Iterator, with another State appended after the Iterator
11861186 * is empty.
11871187 */
1188- private def stateFromIteratorConcatSuffix [A ](it : Iterator [A ]^ )(suffix : => State [A ]^ ): State [A ]^ {it, suffix} =
1188+ private def stateFromIteratorConcatSuffix [A ](it : Iterator [A ]^ )(suffix : => State [A ]^ ): State [A ]^ {it, suffix* } =
11891189 if (it.hasNext) sCons(it.next(), newLL(stateFromIteratorConcatSuffix(it)(suffix)))
11901190 else suffix
11911191
@@ -1307,7 +1307,7 @@ object LazyListIterable extends IterableFactory[LazyListIterable] {
13071307 extends collection.WithFilter [A , LazyListIterable ] {
13081308 private [this ] val filtered = lazyList.filter(p)
13091309 def map [B ](f : A => B ): LazyListIterable [B ]^ {this , f} = filtered.map(f)
1310- def flatMap [B ](f : A => IterableOnce [B ]^ ): LazyListIterable [B ]^ {this , f} = filtered.flatMap(f)
1310+ def flatMap [B ](f : A => IterableOnce [B ]^ ): LazyListIterable [B ]^ {this , f* } = filtered.flatMap(f)
13111311 def foreach [U ](f : A => U ): Unit = filtered.foreach(f)
13121312 def withFilter (q : A => Boolean ): collection.WithFilter [A , LazyListIterable ]^ {this , q} = new WithFilter (filtered, q)
13131313 }
@@ -1353,7 +1353,7 @@ object LazyListIterable extends IterableFactory[LazyListIterable] {
13531353 final class DeferredState [A ] {
13541354 private [this ] var _state : (() => State [A ]^ ) @ uncheckedCaptures = _
13551355
1356- def eval (): State [A ]^ = {
1356+ def eval (): State [A ]^ { this } = {
13571357 val state = _state
13581358 if (state == null ) throw new IllegalStateException (" uninitialized" )
13591359 state()
0 commit comments