@@ -8,6 +8,8 @@ import annotation.tailrec
88import caps .cap
99import caps .unsafe .unsafeAssumeSeparate
1010
11+ import language .experimental .captureChecking
12+
1113/** A strawman architecture for new collections. It contains some
1214 * example collection classes and methods with the intent to expose
1315 * some key issues. It would be good to compare this to other
@@ -448,7 +450,6 @@ object CollectionStrawMan5 {
448450 }
449451
450452 case class Filter [A ](val underlying : Iterable [A ]^ , p : A => Boolean ) extends View [A ] {
451- this : Filter [A ]^ {underlying, p} =>
452453 def iterator : Iterator [A ]^ {this } = underlying.iterator.filter(p)
453454 }
454455
@@ -466,37 +467,31 @@ object CollectionStrawMan5 {
466467 case _ => new Filter (underlying, pp)
467468
468469 case class Partition [A ](val underlying : Iterable [A ]^ , p : A => Boolean ) {
469- self : Partition [A ]^ {underlying, p} =>
470-
471470 class Partitioned (expected : Boolean ) extends View [A ]:
472- this : Partitioned ^ {self } =>
471+ this : Partitioned ^ {Partition . this } =>
473472 def iterator : Iterator [A ]^ {this } =
474473 underlying.iterator.filter((x : A ) => p(x) == expected)
475474
476- val left : Partitioned ^ {self } = Partitioned (true )
477- val right : Partitioned ^ {self } = Partitioned (false )
475+ val left : Partitioned ^ {this } = Partitioned (true )
476+ val right : Partitioned ^ {this } = Partitioned (false )
478477 }
479478
480479 case class Drop [A ](underlying : Iterable [A ]^ , n : Int ) extends View [A ] {
481- this : Drop [A ]^ {underlying} =>
482480 def iterator : Iterator [A ]^ {this } = underlying.iterator.drop(n)
483481 override def knownLength =
484482 if (underlying.knownLength >= 0 ) underlying.knownLength - n max 0 else - 1
485483 }
486484
487485 case class Map [A , B ](underlying : Iterable [A ]^ , f : A => B ) extends View [B ] {
488- this : Map [A , B ]^ {underlying, f} =>
489486 def iterator : Iterator [B ]^ {this } = underlying.iterator.map(f)
490487 override def knownLength = underlying.knownLength
491488 }
492489
493490 case class FlatMap [A , B ](underlying : Iterable [A ]^ , f : A => IterableOnce [B ]^ ) extends View [B ] {
494- this : FlatMap [A , B ]^ {underlying, f} =>
495491 def iterator : Iterator [B ]^ {this } = underlying.iterator.flatMap(f)
496492 }
497493
498494 case class Concat [A ](underlying : Iterable [A ]^ , other : IterableOnce [A ]^ ) extends View [A ] {
499- this : Concat [A ]^ {underlying, other} =>
500495 def iterator : Iterator [A ]^ {this } = underlying.iterator ++ other
501496 override def knownLength = other match {
502497 case other : Iterable [_] if underlying.knownLength >= 0 && other.knownLength >= 0 =>
@@ -507,7 +502,6 @@ object CollectionStrawMan5 {
507502 }
508503
509504 case class Zip [A , B ](underlying : Iterable [A ]^ , other : IterableOnce [B ]^ ) extends View [(A , B )] {
510- this : Zip [A , B ]^ {underlying, other} =>
511505 def iterator : Iterator [(A , B )]^ {this } = underlying.iterator.zip(other)
512506 override def knownLength = other match {
513507 case other : Iterable [_] if underlying.knownLength >= 0 && other.knownLength >= 0 =>
0 commit comments