diff --git a/library/src/scala/collection/Iterator.scala b/library/src/scala/collection/Iterator.scala index bb90b859944f..38fe04a3d208 100644 --- a/library/src/scala/collection/Iterator.scala +++ b/library/src/scala/collection/Iterator.scala @@ -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 @@ -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 diff --git a/library/src/scala/collection/generic/IsIterable.scala b/library/src/scala/collection/generic/IsIterable.scala index 4ba72ff3fe08..b9f1cce6abd6 100644 --- a/library/src/scala/collection/generic/IsIterable.scala +++ b/library/src/scala/collection/generic/IsIterable.scala @@ -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., @@ -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] diff --git a/library/src/scala/collection/generic/IsIterableOnce.scala b/library/src/scala/collection/generic/IsIterableOnce.scala index 6bdad3287ede..c00f979fa111 100644 --- a/library/src/scala/collection/generic/IsIterableOnce.scala +++ b/library/src/scala/collection/generic/IsIterableOnce.scala @@ -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]`. @@ -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] diff --git a/library/src/scala/collection/generic/IsSeq.scala b/library/src/scala/collection/generic/IsSeq.scala index 3e5b644a7ea1..849045129a91 100644 --- a/library/src/scala/collection/generic/IsSeq.scala +++ b/library/src/scala/collection/generic/IsSeq.scala @@ -15,7 +15,6 @@ package generic import scala.language.`2.13` import language.experimental.captureChecking -import caps.unsafe.untrackedCaptures import scala.reflect.ClassTag @@ -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]` * diff --git a/library/src/scala/collection/immutable/LazyListIterable.scala b/library/src/scala/collection/immutable/LazyListIterable.scala index 790b640fb7f6..e81475cefeed 100644 --- a/library/src/scala/collection/immutable/LazyListIterable.scala +++ b/library/src/scala/collection/immutable/LazyListIterable.scala @@ -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. @@ -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)