@@ -712,39 +712,25 @@ extension Collection {
712
712
public func _failEarlyRangeCheck( _ index: Index , bounds: Range < Index > ) {
713
713
// FIXME: swift-3-indexing-model: tests.
714
714
_precondition (
715
- bounds. lowerBound <= index,
716
- " Out of bounds: index < startIndex " )
717
- _precondition (
718
- index < bounds. upperBound,
719
- " Out of bounds: index >= endIndex " )
715
+ bounds. lowerBound <= index && index < bounds. upperBound,
716
+ " Index out of bounds " )
720
717
}
721
718
722
719
@inlinable
723
720
public func _failEarlyRangeCheck( _ index: Index , bounds: ClosedRange < Index > ) {
724
721
// FIXME: swift-3-indexing-model: tests.
725
722
_precondition (
726
- bounds. lowerBound <= index,
727
- " Out of bounds: index < startIndex " )
728
- _precondition (
729
- index <= bounds. upperBound,
730
- " Out of bounds: index > endIndex " )
723
+ bounds. lowerBound <= index && index <= bounds. upperBound,
724
+ " Index out of bounds " )
731
725
}
732
726
733
727
@inlinable
734
728
public func _failEarlyRangeCheck( _ range: Range < Index > , bounds: Range < Index > ) {
735
729
// FIXME: swift-3-indexing-model: tests.
736
730
_precondition (
737
- bounds. lowerBound <= range. lowerBound,
738
- " Out of bounds: range begins before startIndex " )
739
- _precondition (
740
- range. lowerBound <= bounds. upperBound,
741
- " Out of bounds: range ends after endIndex " )
742
- _precondition (
743
- bounds. lowerBound <= range. upperBound,
744
- " Out of bounds: range ends before bounds.lowerBound " )
745
- _precondition (
731
+ bounds. lowerBound <= range. lowerBound &&
746
732
range. upperBound <= bounds. upperBound,
747
- " Out of bounds: range begins after bounds.upperBound " )
733
+ " Range out of bounds" )
748
734
}
749
735
750
736
/// Returns an index that is the specified distance from the given index.
0 commit comments