Skip to content

Commit 8e0cac4

Browse files
committed
Drop most explicit self types in the standard library
They were causing cycles before. With the new policy these types don't need to be given explicitly anymore. I verified that the simple "Option" test now compiles. Fixes #19398
1 parent 3c1d0de commit 8e0cac4

File tree

13 files changed

+3
-30
lines changed

13 files changed

+3
-30
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ object IndexedSeqView {
5555

5656
@SerialVersionUID(3L)
5757
private[collection] class IndexedSeqViewIterator[A](self: IndexedSeqView[A]^) extends AbstractIterator[A] with Serializable {
58-
this: IndexedSeqViewIterator[A]^ =>
5958
private[this] var current = 0
6059
private[this] var remainder = self.length
6160
override def knownSize: Int = remainder
@@ -90,7 +89,6 @@ object IndexedSeqView {
9089
}
9190
@SerialVersionUID(3L)
9291
private[collection] class IndexedSeqViewReverseIterator[A](self: IndexedSeqView[A]^) extends AbstractIterator[A] with Serializable {
93-
this: IndexedSeqViewReverseIterator[A]^ =>
9492
private[this] var remainder = self.length
9593
private[this] var pos = remainder - 1
9694
@inline private[this] def _hasNext: Boolean = remainder > 0

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* See the NOTICE file distributed with this work for
1010
* additional information regarding copyright ownership.
1111
*/
12-
1312
package scala
1413
package collection
1514

@@ -29,7 +28,6 @@ import language.experimental.captureChecking
2928
trait Iterable[+A] extends IterableOnce[A]
3029
with IterableOps[A, Iterable, Iterable[A]]
3130
with IterableFactoryDefaults[A, Iterable] {
32-
this: Iterable[A]^ =>
3331

3432
// The collection itself
3533
@deprecated("toIterable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn't copy non-immutable collections", "2.13.7")
@@ -134,7 +132,6 @@ trait Iterable[+A] extends IterableOnce[A]
134132
* and may be nondeterministic.
135133
*/
136134
trait IterableOps[+A, +CC[_], +C] extends Any with IterableOnce[A] with IterableOnceOps[A, CC, C] {
137-
this: IterableOps[A, CC, C]^ =>
138135

139136
/**
140137
* @return This collection as an `Iterable[A]`. No new collection will be built if `this` is already an `Iterable[A]`.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import language.experimental.captureChecking
4343
* @define coll collection
4444
*/
4545
trait IterableOnce[+A] extends Any {
46-
this: IterableOnce[A]^ =>
4746

4847
/** Iterator can be used only once */
4948
def iterator: Iterator[A]^{this}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,5 +1302,4 @@ object Iterator extends IterableFactory[Iterator] {
13021302
}
13031303

13041304
/** Explicit instantiation of the `Iterator` trait to reduce class file size in subclasses. */
1305-
abstract class AbstractIterator[+A] extends Iterator[A]:
1306-
this: Iterator[A]^ =>
1305+
abstract class AbstractIterator[+A] extends Iterator[A]

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ trait Map[K, +V]
104104
trait MapOps[K, +V, +CC[_, _] <: IterableOps[_, AnyConstr, _], +C]
105105
extends IterableOps[(K, V), Iterable, C]
106106
with PartialFunction[K, V] {
107-
this: MapOps[K, V, CC, C]^ =>
108107

109108
override def view: MapView[K, V]^{this} = new MapView.Id(this)
110109

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import caps.unsafe.unsafeAssumePure
2121
trait MapView[K, +V]
2222
extends MapOps[K, V, ({ type l[X, Y] = View[(X, Y)] })#l, View[(K, V)]]
2323
with View[(K, V)] {
24-
this: MapView[K, V]^ =>
2524

2625
override def view: MapView[K, V]^{this} = this
2726

@@ -191,6 +190,5 @@ trait MapViewFactory extends collection.MapFactory[({ type l[X, Y] = View[(X, Y)
191190

192191
/** Explicit instantiation of the `MapView` trait to reduce class file size in subclasses. */
193192
@SerialVersionUID(3L)
194-
abstract class AbstractMapView[K, +V] extends AbstractView[(K, V)] with MapView[K, V]:
195-
this: AbstractMapView[K, V]^ =>
193+
abstract class AbstractMapView[K, +V] extends AbstractView[(K, V)] with MapView[K, V]
196194

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import scala.collection.Stepper.EfficientSplit
3939
* @tparam A the element type of the Stepper
4040
*/
4141
trait Stepper[@specialized(Double, Int, Long) +A] {
42-
this: Stepper[A]^ =>
4342

4443
/** Check if there's an element available. */
4544
def hasStep: Boolean
@@ -186,7 +185,6 @@ object Stepper {
186185

187186
/** A Stepper for arbitrary element types. See [[Stepper]]. */
188187
trait AnyStepper[+A] extends Stepper[A] {
189-
this: AnyStepper[A]^ =>
190188

191189
def trySplit(): AnyStepper[A]
192190

@@ -258,7 +256,6 @@ object AnyStepper {
258256

259257
/** A Stepper for Ints. See [[Stepper]]. */
260258
trait IntStepper extends Stepper[Int] {
261-
this: IntStepper^ =>
262259

263260
def trySplit(): IntStepper
264261

@@ -298,7 +295,6 @@ object IntStepper {
298295

299296
/** A Stepper for Doubles. See [[Stepper]]. */
300297
trait DoubleStepper extends Stepper[Double] {
301-
this: DoubleStepper^ =>
302298
def trySplit(): DoubleStepper
303299

304300
def spliterator[B >: Double]: Spliterator.OfDouble^{this} = new DoubleStepper.DoubleStepperSpliterator(this)
@@ -338,7 +334,6 @@ object DoubleStepper {
338334

339335
/** A Stepper for Longs. See [[Stepper]]. */
340336
trait LongStepper extends Stepper[Long] {
341-
this: LongStepper^ =>
342337

343338
def trySplit(): LongStepper^{this}
344339

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import language.experimental.captureChecking
2424
* @define Coll `View`
2525
*/
2626
trait View[+A] extends Iterable[A] with IterableOps[A, View, View[A]] with IterableFactoryDefaults[A, View] with Serializable {
27-
this: View[A]^ =>
2827

2928
override def view: View[A]^{this} = this
3029

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import language.experimental.captureChecking
2323
*/
2424
@SerialVersionUID(3L)
2525
abstract class WithFilter[+A, +CC[_]] extends Serializable {
26-
this: WithFilter[A, CC]^ =>
2726

2827
/** Builds a new collection by applying a function to all elements of the
2928
* `filtered` outer $coll.

scala2-library-cc/src/scala/collection/immutable/Iterable.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import language.experimental.captureChecking
2525
trait Iterable[+A] extends collection.Iterable[A]
2626
with collection.IterableOps[A, Iterable, Iterable[A]]
2727
with IterableFactoryDefaults[A, Iterable] {
28-
this: Iterable[A]^ =>
29-
3028
override def iterableFactory: IterableFactory[Iterable] = Iterable
3129
}
3230

0 commit comments

Comments
 (0)