File tree 1 file changed +5
-5
lines changed
StandardLibrary/Sources/Core
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
/// A half-open interval from a lower bound up to, but not including, an uppor bound.
2
- public type Range<Bound: SemiRegular & Comparable > {
2
+ public type Range<Bound: SemiRegular> {
3
3
4
4
// TODO: private(set)
5
5
/// The minimum value included in `self`.
@@ -22,13 +22,13 @@ public type Range<Bound: SemiRegular & Comparable> {
22
22
}
23
23
24
24
/// Returns `true` iff `element` is contained in `self`.
25
- public fun contains(_ element: Bound ) -> Bool {
26
- (element >= lower_bound) && (element < upper_bound)
25
+ public fun contains<B: Comparable where Bound == B> (_ element: B ) -> Bool {
26
+ (( element as! Bound) >= lower_bound) && (( element as! Bound) < upper_bound)
27
27
}
28
28
29
29
/// Returns `true` iff `other` is contained in `self`.
30
- public fun contains(_ other: Self ) -> Bool {
31
- (other.lower_bound >= self.lower_bound) && (other.upper_bound <= self.upper_bound)
30
+ public fun contains<B: Comparable where Bound == B> (_ other: Range<B> ) -> Bool {
31
+ (( other.lower_bound as! Bound) >= self.lower_bound) && (( other.upper_bound as! Bound) <= self.upper_bound)
32
32
}
33
33
34
34
}
You can’t perform that action at this time.
0 commit comments