Skip to content

Commit 844d70a

Browse files
committed
Finish capture checking standard library
1 parent 856b584 commit 844d70a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

scala2-library-cc/src/scala/collection/Iterator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ trait Iterator[+A] extends IterableOnce[A] with IterableOnceOps[A, Iterator, Ite
589589
}
590590

591591
def flatMap[B](@caps.use f: A => IterableOnce[B]^): Iterator[B]^{this, f*} = new AbstractIterator[B] {
592-
private[this] var cur: Iterator[B]^{f} = Iterator.empty
592+
private[this] var cur: Iterator[B]^{f*} = Iterator.empty
593593
/** Trillium logic boolean: -1 = unknown, 0 = false, 1 = true */
594594
private[this] var _hasNext: Int = -1
595595

scala2-library-cc/src/scala/collection/immutable/LazyListIterable.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ 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](@caps.use f: A => IterableOnce[B]^): LazyListIterable[B]^{this, f} =
595+
override def flatMap[B](@caps.use f: A => IterableOnce[B]^): LazyListIterable[B]^{this, f*} =
596596
if (knownIsEmpty) LazyListIterable.empty
597597
else LazyListIterable.flatMapImpl(this, f)
598598

@@ -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) {
@@ -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](@caps.use f: A => IterableOnce[B]^): LazyListIterable[B]^{this, f} = filtered.flatMap(f)
1310+
def flatMap[B](@caps.use 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
}

0 commit comments

Comments
 (0)