Skip to content

Commit 1a7d1a5

Browse files
committed
Make collection/Set capture checked
1 parent 818de2e commit 1a7d1a5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/pos-special/stdlib/collection/Set.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import scala.util.hashing.MurmurHash3
1717
import java.lang.String
1818

1919
import scala.annotation.nowarn
20+
import language.experimental.captureChecking
2021

2122
/** Base trait for set collections.
2223
*/
@@ -25,6 +26,7 @@ trait Set[A]
2526
with SetOps[A, Set, Set[A]]
2627
with Equals
2728
with IterableFactoryDefaults[A, Set] {
29+
self: Set[A] =>
2830

2931
def canEqual(that: Any) = true
3032

@@ -86,8 +88,7 @@ trait Set[A]
8688
* @define Coll `Set`
8789
*/
8890
trait SetOps[A, +CC[_], +C <: SetOps[A, CC, C]]
89-
extends IterableOps[A, CC, C]
90-
with (A => Boolean) {
91+
extends IterableOps[A, CC, C], (A -> Boolean) { self =>
9192

9293
def contains(elem: A): Boolean
9394

@@ -234,7 +235,7 @@ trait SetOps[A, +CC[_], +C <: SetOps[A, CC, C]]
234235
case that: collection.Iterable[A] => new View.Concat(this, that)
235236
case _ => iterator.concat(that.iterator)
236237
})
237-
}
238+
}
238239

239240
@deprecated("Consider requiring an immutable Set or fall back to Set.union", "2.13.0")
240241
def + (elem: A): C = fromSpecific(new View.Appended(this, elem))

0 commit comments

Comments
 (0)