Skip to content

Commit 361b6ce

Browse files
committed
Drop an unsafeAssumePure in Iterator
1 parent d97d2c4 commit 361b6ce

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tests/pos-special/stdlib/collection/Iterator.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import scala.annotation.tailrec
1717
import scala.annotation.unchecked.{uncheckedVariance, uncheckedCaptures}
1818
import scala.runtime.Statics
1919
import language.experimental.captureChecking
20-
import caps.unsafe.unsafeAssumePure
2120
import annotation.unchecked.uncheckedCaptures
2221

2322

@@ -1146,9 +1145,7 @@ object Iterator extends IterableFactory[Iterator] {
11461145
* Nested ConcatIterators are merged to avoid blowing the stack.
11471146
*/
11481147
private final class ConcatIterator[+A](val from: Iterator[A]^) extends AbstractIterator[A] {
1149-
private var current: Iterator[A @uncheckedCaptures] = from.unsafeAssumePure
1150-
// This should be Iteratpr[A]^, but fails since mutable variables can't capture cap.
1151-
// To do better we'd need to track nesting levels for universal capabiltities.
1148+
private var current: Iterator[A @uncheckedCaptures]^{cap[ConcatIterator]} = from
11521149
private var tail: ConcatIteratorCell[A @uncheckedVariance @uncheckedCaptures] = null
11531150
private var last: ConcatIteratorCell[A @uncheckedVariance @uncheckedCaptures] = null
11541151
private var currentHasNextChecked = false

0 commit comments

Comments
 (0)