Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions library/src/scala/collection/Iterator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import scala.collection.mutable.{ArrayBuffer, ArrayBuilder, Builder, ImmutableBu
import scala.annotation.tailrec
import scala.annotation.unchecked.uncheckedVariance
import scala.runtime.Statics
import caps.unsafe.untrackedCaptures

/** Iterators are data structures that allow to iterate over a sequence
* of elements. They have a `hasNext` method for checking
Expand Down Expand Up @@ -918,12 +917,7 @@ trait Iterator[+A] extends IterableOnce[A] with IterableOnceOps[A, Iterator, Ite
*/
def patch[B >: A](from: Int, patchElems: Iterator[B]^, replaced: Int): Iterator[B]^{this, patchElems} =
new AbstractIterator[B] {
// TODO We should be able to prove that origElems is safe even though it is
// declared as Iterator[B]^. We could show that origElems is never assigned a
// freh cap. Maybe we can invent another annotation that is checked and that
// shows that the `^` is just used as an upper bound for concete non-fresh
// capabilities.
@untrackedCaptures private[this] var origElems: Iterator[B]^ = self
private[this] var origElems: Iterator[B]^{self} = self
// > 0 => that many more elems from `origElems` before switching to `patchElems`
// 0 => need to drop elems from `origElems` and start using `patchElems`
// -1 => have dropped elems from `origElems`, will be using `patchElems` until it's empty
Expand Down
4 changes: 1 addition & 3 deletions library/src/scala/collection/generic/IsIterable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package generic

import scala.language.`2.13`
import language.experimental.captureChecking
import caps.unsafe.untrackedCaptures

/** A trait which can be used to avoid code duplication when defining extension
* methods that should be applicable both to existing Scala collections (i.e.,
Expand Down Expand Up @@ -124,8 +123,7 @@ transparent trait IsIterable[Repr] extends IsIterableOnce[Repr] {
type C

@deprecated("'conversion' is now a method named 'apply'", "2.13.0")
@untrackedCaptures
override val conversion: Repr => IterableOps[A, Iterable, C] = apply(_)
override val conversion: Repr ->{this} IterableOps[A, Iterable, C] = apply(_)

/** A conversion from the type `Repr` to `IterableOps[A, Iterable, C]` */
def apply(coll: Repr): IterableOps[A, Iterable, C]
Expand Down
4 changes: 1 addition & 3 deletions library/src/scala/collection/generic/IsIterableOnce.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package generic

import scala.language.`2.13`
import language.experimental.captureChecking
import caps.unsafe.untrackedCaptures

/** Type class witnessing that a collection representation type `Repr` has
* elements of type `A` and has a conversion to `IterableOnce[A]`.
Expand Down Expand Up @@ -47,8 +46,7 @@ transparent trait IsIterableOnce[Repr] {
type A

@deprecated("'conversion' is now a method named 'apply'", "2.13.0")
@untrackedCaptures
val conversion: Repr => IterableOnce[A] = apply(_)
val conversion: Repr ->{this} IterableOnce[A] = apply(_)

/** A conversion from the representation type `Repr` to a `IterableOnce[A]`. */
def apply(coll: Repr): IterableOnce[A]
Expand Down
4 changes: 1 addition & 3 deletions library/src/scala/collection/generic/IsSeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package generic

import scala.language.`2.13`
import language.experimental.captureChecking
import caps.unsafe.untrackedCaptures

import scala.reflect.ClassTag

Expand All @@ -32,8 +31,7 @@ import scala.reflect.ClassTag
transparent trait IsSeq[Repr] extends IsIterable[Repr] {

@deprecated("'conversion' is now a method named 'apply'", "2.13.0")
@untrackedCaptures
override val conversion: Repr => SeqOps[A, Iterable, C] = apply(_)
override val conversion: Repr ->{this} SeqOps[A, Iterable, C] = apply(_)

/** A conversion from the type `Repr` to `SeqOps[A, Iterable, C]`
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import scala.collection.generic.SerializeEnd
import scala.collection.mutable.{Builder, ReusableBuilder, StringBuilder}
import scala.language.implicitConversions
import scala.runtime.Statics
import caps.unsafe.untrackedCaptures

/** This class implements an immutable linked list. We call it "lazy"
* because it computes its elements only when they are needed.
Expand Down Expand Up @@ -1375,7 +1374,7 @@ object LazyListIterable extends IterableFactory[LazyListIterable] {

private final class WithFilter[A] private[LazyListIterable](lazyList: LazyListIterable[A]^, p: A => Boolean)
extends collection.WithFilter[A, LazyListIterable] {
@untrackedCaptures private[this] val filtered = lazyList.filter(p)
private[this] val filtered: LazyListIterable[A]^{this} = lazyList.filter(p)
def map[B](f: A => B): LazyListIterable[B]^{this, f} = filtered.map(f)
def flatMap[B](f: A => IterableOnce[B]^): LazyListIterable[B]^{this, f} = filtered.flatMap(f)
def foreach[U](f: A => U): Unit = filtered.foreach(f)
Expand Down
Loading