Skip to content

Commit b23bf45

Browse files
committed
Add View.scala to stdlib test
1 parent 46327f5 commit b23bf45

File tree

5 files changed

+555
-12
lines changed

5 files changed

+555
-12
lines changed

tests/pos/stdlib/View.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
collection/View.scala

tests/pos/stdlib/collection/Iterable.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ trait IterableOps[+A, +CC[_], +C] extends Any with IterableOnce[A] with Iterable
685685

686686
def map[B](f: A => B): CC[B]^{this, f} = iterableFactory.from(new View.Map(this, f))
687687

688-
def flatMap[B](f: A => IterableOnce[B]): CC[B]^{this, f} = iterableFactory.from(new View.FlatMap(this, f))
688+
def flatMap[B](f: A => IterableOnce[B]^): CC[B]^{this, f} = iterableFactory.from(new View.FlatMap(this, f))
689689

690690
def flatten[B](implicit asIterable: A -> IterableOnce[B]): CC[B]^{this} = flatMap(asIterable)
691691

@@ -714,8 +714,8 @@ trait IterableOps[+A, +CC[_], +C] extends Any with IterableOnce[A] with Iterable
714714
* and the second one made of those wrapped in [[scala.util.Right]].
715715
*/
716716
def partitionMap[A1, A2](f: A => Either[A1, A2]): (CC[A1]^{this, f}, CC[A2]^{this, f}) = {
717-
val left: View[A1]^{f} = new LeftPartitionMapped(this, f)
718-
val right: View[A2]^{f} = new RightPartitionMapped(this, f)
717+
val left: View[A1]^{f, this} = new LeftPartitionMapped(this, f)
718+
val right: View[A2]^{f, this} = new RightPartitionMapped(this, f)
719719
(iterableFactory.from(left), iterableFactory.from(right))
720720
}
721721

@@ -788,8 +788,8 @@ trait IterableOps[+A, +CC[_], +C] extends Any with IterableOnce[A] with Iterable
788788
* half of each element pair of this $coll.
789789
*/
790790
def unzip[A1, A2](implicit asPair: A -> (A1, A2)): (CC[A1]^{this}, CC[A2]^{this}) = {
791-
val first: View[A1] = new View.Map[A, A1](this, asPair(_)._1)
792-
val second: View[A2] = new View.Map[A, A2](this, asPair(_)._2)
791+
val first: View[A1]^{this} = new View.Map[A, A1](this, asPair(_)._1)
792+
val second: View[A2]^{this} = new View.Map[A, A2](this, asPair(_)._2)
793793
(iterableFactory.from(first), iterableFactory.from(second))
794794
}
795795

@@ -815,9 +815,9 @@ trait IterableOps[+A, +CC[_], +C] extends Any with IterableOnce[A] with Iterable
815815
* third member of each element triple of this $coll.
816816
*/
817817
def unzip3[A1, A2, A3](implicit asTriple: A -> (A1, A2, A3)): (CC[A1]^{this}, CC[A2]^{this}, CC[A3]^{this}) = {
818-
val first: View[A1] = new View.Map[A, A1](this, asTriple(_)._1)
819-
val second: View[A2] = new View.Map[A, A2](this, asTriple(_)._2)
820-
val third: View[A3] = new View.Map[A, A3](this, asTriple(_)._3)
818+
val first: View[A1]^{this} = new View.Map[A, A1](this, asTriple(_)._1)
819+
val second: View[A2]^{this} = new View.Map[A, A2](this, asTriple(_)._2)
820+
val third: View[A3]^{this} = new View.Map[A, A3](this, asTriple(_)._3)
821821
(iterableFactory.from(first), iterableFactory.from(second), iterableFactory.from(third))
822822
}
823823

tests/pos/stdlib/collection/IterableOnce.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ final class IterableOnceExtensionMethods[A](private val it: IterableOnce[A]) ext
247247
}
248248

249249
@deprecated("Use .iterator.flatMap instead or consider requiring an Iterable", "2.13.0")
250-
def flatMap[B](f: A => IterableOnce[B]): IterableOnce[B]^{f} = it match {
250+
def flatMap[B](f: A => IterableOnce[B]^): IterableOnce[B]^{f} = it match {
251251
case it: Iterable[A] => it.flatMap(f)
252252
case _ => it.iterator.flatMap(f)
253253
}
@@ -441,7 +441,7 @@ trait IterableOnceOps[+A, +CC[_], +C] extends Any { this: IterableOnce[A]^ =>
441441
* @return a new $coll resulting from applying the given collection-valued function
442442
* `f` to each element of this $coll and concatenating the results.
443443
*/
444-
def flatMap[B](f: A => IterableOnce[B]): CC[B]^{this, f}
444+
def flatMap[B](f: A => IterableOnce[B]^): CC[B]^{this, f}
445445

446446
/** Converts this $coll of iterable collections into
447447
* a $coll formed by the elements of these iterable

tests/pos/stdlib/collection/Iterator.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ trait Iterator[+A] extends IterableOnce[A] with IterableOnceOps[A, Iterator, Ite
588588
def next() = f(self.next())
589589
}
590590

591-
def flatMap[B](f: A => IterableOnce[B]): Iterator[B]^{this, f} = new AbstractIterator[B] {
592-
private[this] var cur: Iterator[B] = Iterator.empty
591+
def flatMap[B](f: A => IterableOnce[B]^): Iterator[B]^{this, f} = new AbstractIterator[B] {
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

0 commit comments

Comments
 (0)