Skip to content

Commit ff73a2f

Browse files
committed
Use unsafeAssumePure instead of asInstanceOf in stdlib-cc
1 parent 1e79a2d commit ff73a2f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import scala.annotation.tailrec
1717
import scala.annotation.unchecked.uncheckedVariance
1818
import scala.runtime.Statics
1919
import language.experimental.captureChecking
20-
20+
import caps.unsafe.unsafeAssumePure
2121

2222
/** Iterators are data structures that allow to iterate over a sequence
2323
* of elements. They have a `hasNext` method for checking
@@ -1008,7 +1008,7 @@ object Iterator extends IterableFactory[Iterator] {
10081008
def newBuilder[A]: Builder[A, Iterator[A]] =
10091009
new ImmutableBuilder[A, Iterator[A]](empty[A]) {
10101010
override def addOne(elem: A): this.type = { elems = elems ++ single(elem); this }
1011-
}.asInstanceOf // !!! CC unsafe op
1011+
}.unsafeAssumePure
10121012

10131013
/** Creates iterator that produces the results of some element computation a number of times.
10141014
*
@@ -1160,7 +1160,7 @@ object Iterator extends IterableFactory[Iterator] {
11601160
@tailrec def merge(): Unit =
11611161
if (current.isInstanceOf[ConcatIterator[_]]) {
11621162
val c: ConcatIterator[A] = current.asInstanceOf
1163-
current = c.current.asInstanceOf // !!! CC unsafe op
1163+
current = c.current.unsafeAssumePure // !!! CC unsafe op
11641164
currentHasNextChecked = c.currentHasNextChecked
11651165
if (c.tail != null) {
11661166
if (last == null) last = c.last

0 commit comments

Comments
 (0)