@@ -529,11 +529,7 @@ public struct PartialRangeThrough<Bound: Comparable> {
529
529
public let upperBound : Bound
530
530
531
531
@inlinable // trivial-implementation
532
- public init ( _ upperBound: Bound ) {
533
- _precondition ( upperBound == upperBound,
534
- " PartialRangeThrough requries that upperBound not be unordered. " )
535
- self . upperBound = upperBound
536
- }
532
+ public init ( _ upperBound: Bound ) { self . upperBound = upperBound }
537
533
}
538
534
539
535
extension PartialRangeThrough : RangeExpression {
@@ -648,11 +644,7 @@ public struct PartialRangeFrom<Bound: Comparable> {
648
644
public let lowerBound : Bound
649
645
650
646
@inlinable // trivial-implementation
651
- public init ( _ lowerBound: Bound ) {
652
- _precondition ( lowerBound == lowerBound,
653
- " PartialRangeFrom requries that lowerBound not be unordered. " )
654
- self . lowerBound = lowerBound
655
- }
647
+ public init ( _ lowerBound: Bound ) { self . lowerBound = lowerBound }
656
648
}
657
649
658
650
extension PartialRangeFrom : RangeExpression {
@@ -731,6 +723,8 @@ extension Comparable {
731
723
/// - Parameters:
732
724
/// - minimum: The lower bound for the range.
733
725
/// - maximum: The upper bound for the range.
726
+ ///
727
+ /// - Precondition: `minimum <= maximum`.
734
728
@_transparent
735
729
public static func ..< ( minimum: Self , maximum: Self ) -> Range < Self > {
736
730
_precondition ( minimum <= maximum,
@@ -760,8 +754,12 @@ extension Comparable {
760
754
/// // Prints "[10, 20, 30]"
761
755
///
762
756
/// - Parameter maximum: The upper bound for the range.
757
+ ///
758
+ /// - Precondition: `maximum` must compare equal to itself (i.e. cannot be NaN).
763
759
@_transparent
764
760
public static prefix func ..< ( maximum: Self) - > PartialRangeUpTo< Self> {
761
+ _precondition ( maximum == maximum,
762
+ " Range cannot have an unordered upper bound. " )
765
763
return PartialRangeUpTo ( maximum)
766
764
}
767
765
@@ -787,8 +785,12 @@ extension Comparable {
787
785
/// // Prints "[10, 20, 30, 40]"
788
786
///
789
787
/// - Parameter maximum: The upper bound for the range.
788
+ ///
789
+ /// - Precondition: `maximum` must compare equal to itself (i.e. cannot be NaN).
790
790
@_transparent
791
791
public static prefix func ... ( maximum: Self) - > PartialRangeThrough< Self> {
792
+ _precondition ( maximum == maximum,
793
+ " Range cannot have an unordered upper bound. " )
792
794
return PartialRangeThrough ( maximum)
793
795
}
794
796
@@ -814,8 +816,12 @@ extension Comparable {
814
816
/// // Prints "[40, 50, 60, 70]"
815
817
///
816
818
/// - Parameter minimum: The lower bound for the range.
819
+ ///
820
+ /// - Precondition: `minimum` must compare equal to itself (i.e. cannot be NaN).
817
821
@_transparent
818
822
public static postfix func ... ( minimum: Self) - > PartialRangeFrom< Self> {
823
+ _precondition ( minimum == minimum,
824
+ " Range cannot have an unordered lower bound. " )
819
825
return PartialRangeFrom ( minimum)
820
826
}
821
827
}
0 commit comments