Skip to content

Commit b81bf02

Browse files
committed
Add IterableOnce operations to IterableOnceOps
Fixes scala/bug#11675 This change is backward compatible, because nothing is removed. It should also be forward compatible, because `IterableOnceOps[A]` had `IterableOnce[A]` as a self-type on 2.13.0, meaning that code relying on the newly introduced methods also worked on 2.13.0 because any `IterableOnceOps[A]` instance was also effectively an `IterableOnce[A]`.
1 parent f23f96c commit b81bf02

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

build.sbt

+7-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ val mimaFilterSettings = Seq(
9494
ProblemFilters.exclude[MissingClassProblem]("scala.reflect.runtime.JavaMirrors$JavaMirror$typeTagCache$"),
9595
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.reflect.api.TypeTags.TypeTagImpl"),
9696
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.reflect.api.Universe.TypeTagImpl"),
97-
),
97+
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.collection.IterableOnceOps.stepper"),
98+
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.collection.IterableOnceOps.iterator"),
99+
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.collection.IterableOnceOps.knownSize"),
100+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.IterableOnceOps.stepper"),
101+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.IterableOnceOps.iterator"),
102+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.IterableOnceOps.knownSize")
103+
)
98104
)
99105

100106
// Save MiMa logs

src/library/scala/collection/IterableOnce.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ object IterableOnce {
296296
* @define coll collection
297297
*
298298
*/
299-
trait IterableOnceOps[+A, +CC[_], +C] extends Any { this: IterableOnce[A] =>
299+
trait IterableOnceOps[+A, +CC[_], +C] extends Any with IterableOnce[A] {
300+
300301
/////////////////////////////////////////////////////////////// Abstract methods that must be implemented
301302

302303
/** Produces a $coll containing cumulative results of applying the

test/files/neg/abstract-report.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
abstract-report.scala:1: error: class Unimplemented needs to be abstract.
22
Missing implementations for 6 members. Stub implementations follow:
3-
// Members declared in scala.collection.IterableOnce
3+
// Members declared in scala.collection.IterableOnceOps
44
def iterator: Iterator[String] = ???
55

66
// Members declared in scala.collection.IterableOps

test/files/neg/abstract-report2.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Baz[T] extends Collection[T]
5454
^
5555
abstract-report2.scala:15: error: class Dingus needs to be abstract.
5656
Missing implementations for 7 members. Stub implementations follow:
57-
// Members declared in scala.collection.IterableOnce
57+
// Members declared in scala.collection.IterableOnceOps
5858
def iterator: Iterator[(Set[Int], String)] = ???
5959

6060
// Members declared in scala.collection.IterableOps

0 commit comments

Comments
 (0)