mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
This commit is contained in:
@@ -23,7 +23,7 @@ GElement = "Iterator.Element"
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension Sequence {
|
||||
/// Return a lazy `Sequence` containing pairs (*n*, *x*), where
|
||||
/// Returns a lazy `Sequence` containing pairs (*n*, *x*), where
|
||||
/// *n*s are consecutive `Int`s starting at zero, and *x*s are
|
||||
/// the elements of `self`:
|
||||
///
|
||||
@@ -125,9 +125,9 @@ extension Sequence ${"" if preds else "where Iterator.Element : Equatable"} {
|
||||
%{
|
||||
if preds:
|
||||
comment = """
|
||||
/// Return true iff `self` begins with elements equivalent to those of
|
||||
/// `possiblePrefix`, using `isEquivalent` as the equivalence test.
|
||||
/// Return true if `possiblePrefix` is empty.
|
||||
/// Returns `true` iff `self` begins with elements equivalent to those of
|
||||
/// `other`, using `isEquivalent` as the equivalence test. Returns `true` if
|
||||
/// `other` is empty.
|
||||
///
|
||||
/// - Requires: `isEquivalent` is an
|
||||
/// [equivalence relation](http://en.wikipedia.org/wiki/Equivalence_relation)."""
|
||||
@@ -135,8 +135,8 @@ if preds:
|
||||
rethrows_ = "rethrows "
|
||||
else:
|
||||
comment = """
|
||||
/// Return true iff the initial elements of `self` are equal to
|
||||
/// `possiblePrefix`. Return true if `possiblePrefix` is empty."""
|
||||
/// Returns `true` iff the initial elements of `self` are equal to `prefix`.
|
||||
/// Returns `true` if `other` is empty."""
|
||||
rethrows_ = ""
|
||||
}%
|
||||
${comment}
|
||||
@@ -179,7 +179,7 @@ extension Sequence ${"" if preds else "where Iterator.Element : Equatable"} {
|
||||
%{
|
||||
if preds:
|
||||
comment = """
|
||||
/// Return true iff `self` and `other` contain equivalent elements, using
|
||||
/// Returns `true` iff `self` and `other` contain equivalent elements, using
|
||||
/// `isEquivalent` as the equivalence test.
|
||||
///
|
||||
/// - Requires: `isEquivalent` is an
|
||||
@@ -187,7 +187,7 @@ if preds:
|
||||
rethrows_ = "rethrows "
|
||||
else:
|
||||
comment = """
|
||||
/// Return `true` iff `self` and `other` contain the same elements in the
|
||||
/// Returns `true` iff `self` and `other` contain the same elements in the
|
||||
/// same order."""
|
||||
rethrows_ = ""
|
||||
}%
|
||||
@@ -235,8 +235,9 @@ extension Sequence ${"" if preds else "where Iterator.Element : Comparable"} {
|
||||
%{
|
||||
if preds:
|
||||
comment = """
|
||||
/// Return true iff `self` precedes `other` in a lexicographical ("dictionary")
|
||||
/// ordering, using `isOrderedBefore` as the comparison between elements.
|
||||
/// Returns `true` iff `self` precedes `other` in a lexicographical
|
||||
/// ("dictionary") ordering, using `isOrderedBefore` as the comparison
|
||||
/// between elements.
|
||||
///
|
||||
/// - Note: This method implements the mathematical notion of lexicographical
|
||||
/// ordering, which has no connection to Unicode. If you are sorting strings
|
||||
@@ -249,8 +250,8 @@ if preds:
|
||||
rethrows_ = "rethrows "
|
||||
else:
|
||||
comment = """
|
||||
/// Return true iff `self` precedes `other` in a lexicographical ("dictionary")
|
||||
/// ordering, using "<" as the comparison between elements.
|
||||
/// Returns `true` iff `self` precedes `other` in a lexicographical
|
||||
/// ("dictionary") ordering, using "<" as the comparison between elements.
|
||||
///
|
||||
/// - Note: This method implements the mathematical notion of lexicographical
|
||||
/// ordering, which has no connection to Unicode. If you are sorting strings
|
||||
@@ -297,7 +298,7 @@ else:
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension Sequence where Iterator.Element : Equatable {
|
||||
/// Return `true` iff `element` is in `self`.
|
||||
/// Returns `true` iff `element` is in `self`.
|
||||
@warn_unused_result
|
||||
public func contains(element: ${GElement}) -> Bool {
|
||||
if let result = _customContainsEquatableElement(element) {
|
||||
@@ -314,7 +315,7 @@ extension Sequence where Iterator.Element : Equatable {
|
||||
}
|
||||
|
||||
extension Sequence {
|
||||
/// Return `true` iff an element in `self` satisfies `predicate`.
|
||||
/// Returns `true` iff an element in `self` satisfies `predicate`.
|
||||
@warn_unused_result
|
||||
public func contains(
|
||||
@noescape predicate: (${GElement}) throws -> Bool
|
||||
@@ -333,7 +334,7 @@ extension Sequence {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension Sequence {
|
||||
/// Return the result of repeatedly calling `combine` with an
|
||||
/// Returns the result of repeatedly calling `combine` with an
|
||||
/// accumulated value initialized to `initial` and each element of
|
||||
/// `self`, in turn, i.e. return
|
||||
/// `combine(combine(...combine(combine(initial, self[0]),
|
||||
@@ -355,7 +356,7 @@ extension Sequence {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension Sequence {
|
||||
/// Return an `Array` containing the elements of `self` in reverse
|
||||
/// Returns an `Array` containing the elements of `self` in reverse
|
||||
/// order.
|
||||
///
|
||||
/// Complexity: O(N), where N is the length of `self`.
|
||||
@@ -378,7 +379,7 @@ extension Sequence {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension Sequence {
|
||||
/// Return an `Array` containing the concatenated results of mapping
|
||||
/// Returns an `Array` containing the concatenated results of mapping
|
||||
/// `transform` over `self`.
|
||||
///
|
||||
/// s.flatMap(transform)
|
||||
@@ -402,7 +403,7 @@ extension Sequence {
|
||||
}
|
||||
|
||||
extension Sequence {
|
||||
/// Return an `Array` containing the non-nil results of mapping
|
||||
/// Returns an `Array` containing the non-nil results of mapping
|
||||
/// `transform` over `self`.
|
||||
///
|
||||
/// - Complexity: O(*M* + *N*), where *M* is the length of `self`
|
||||
|
||||
Reference in New Issue
Block a user