Commit Graph

86 Commits

Author SHA1 Message Date
Dave Abrahams
11259d1d14 [stdlib] indexing model: rename in-place indexing
This time, choose something that's at least compliant with the API
guidelines.
2016-03-23 17:16:20 -07:00
Dave Abrahams
8d9e62b274 [stdlib] indexing model: rename next/previous
I'm not too satisfied with the names for the updating: versions, but
this is a start.
2016-03-22 17:13:54 -07:00
Dmitri Gribenko
a6cd57222a Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-03-21 14:41:15 -07:00
Dave Abrahams
a9dd95c37a [stdlib] indexing model: Generic Mutable Slicing 2016-03-18 15:08:40 -07:00
Dave Abrahams
388833831b Balance parens in gyb file
It was messing with our editor's indentation to have unmatched parens in
gyb'd segments.
2016-03-18 15:05:12 -07:00
Nate Cook
afac511c19 [stdlib] Remove unavailable annotation for MutableCollection.sort() 2016-03-17 16:12:37 -05:00
Dave Abrahams
f493b54e44 [stdlib] indexing model: Interval/Range merge
This is step 1; we still need to introduce ClosedRange.
2016-03-16 15:59:10 -07:00
Dmitri Gribenko
95163c4813 stdlib: New indexing model: fix a new inout violation in Collection.partition() 2016-03-14 18:59:27 -07:00
Dmitri Gribenko
3cde854287 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-03-12 01:11:32 -08:00
Daniel Duan
276370b599 [stdlib] apply SE-0040 to stdlib 2016-03-11 16:01:41 -08:00
Dmitri Gribenko
fc636b94f5 fixup 2016-03-06 02:12:59 -08:00
Dmitri Gribenko
ad1428e1d6 New collection indexing model: removed old index protocols
... and started to fix compiler errors.
2016-03-06 01:53:34 -08:00
Shawn Erickson
fe42606062 [stdlib] - WIP moved aspects of ForwardIndex and BidirectionalIndex into their Collection equivalents 2016-03-04 07:40:59 -08:00
Dmitri Gribenko
d7e82519f5 stdlib: add argument labels to sort() implementation details 2016-02-24 08:52:18 -08:00
Max Moiseev
85766f8db7 [stdlib] availability attributes for indexOf 2016-02-23 14:26:53 -08:00
Max Moiseev
52f0cf49b0 [stdlib] indexOf => index(of:)/index(where:) 2016-02-23 11:45:11 -08:00
Max Moiseev
78ba5d5f3f [stdlib] Requires in comments changed to Precondition 2016-02-19 18:57:26 -08:00
Dmitri Gribenko
dd75aed67a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-17 14:40:05 -08:00
Dmitri Gribenko
efaa39ea79 stdlib: add first argument labels and some other changes to conform to API guidelines 2016-02-15 23:47:54 -08:00
Nate Cook
51251dc133 Convert imperative function summaries to present.
i.e., "Return ..." -> "Returns ..."
2016-02-12 04:20:39 -06:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
David Farler
d45aa36e85 Clean up some things that sneaked into var reverts
- Remove an overload that came back in after rebase
- Minor formatting issues
2016-01-30 10:03:53 -08:00
David Farler
3f635d04c7 Reinstante var bindings in refutable patterns, except function parameters.
This reverts commits: b96e06da44,
                      8f2fbdc93a,
                      93b6962478,
                      64024118f4,
                      a759ca9141,
                      3434f9642b,
                      9f33429891,
                      47c043e8a6.

This commit leaves 'var' on function parameters as a warning to be
merged into Swift 2.2. For Swift 3, this will be an error, to be
converted in a follow-up.
2016-01-29 15:27:08 -08:00
practicalswift
ca9e488f30 [gardening] Add "-*- swift -*-" to *.swift.gyb. Remove from *.swift. 2016-01-23 10:27:03 +01:00
Dmitri Gribenko
9bcd5a1056 Collection.length => .count 2016-01-22 18:41:19 -08:00
Dmitri Gribenko
574052f1be stdlib: standardize fatalError() messages for unavailable APIs 2016-01-21 16:34:54 -08:00
Max Moiseev
86680ec622 [stdlib] @available attributes for removed APIs 2016-01-20 13:08:27 -08:00
Dmitri Gribenko
74ce1ca79c Add unavailable declarations for Swift 2.2 -> 3 migration 2016-01-19 14:32:59 -08:00
Max Moiseev
f51e708a8f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-04 12:25:25 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Dmitri Gribenko
77376883f4 Collection.sortInPlace() => .sort() 2015-12-18 16:20:01 -08:00
Dmitri Gribenko
8f7c9ae3fd Collection.sort() => .sorted() 2015-12-18 16:20:01 -08:00
Dmitri Gribenko
7a33fb124c Remove an unsafeBitCast() that is not actually needed 2015-12-18 16:20:01 -08:00
Dmitri Gribenko
5b728dc859 Remove Range<Index> argument from Collection.partition()
collection.partition(i..<j) => collection[i..<j].partition()
2015-12-18 16:20:01 -08:00
Dmitri Gribenko
73ce9ae7e9 Collection.count => .length
And other API changes that naturally fall out from this, like
Array(repeating:count:) => Array(repeating:length:).
2015-12-17 15:55:29 -08:00
Maxim Moiseev
844b81c46b SequenceType => Sequence 2015-12-09 17:16:56 -08:00
Maxim Moiseev
c678a839dc IndexType => Index 2015-12-09 17:16:42 -08:00
Maxim Moiseev
7e2466c14e CollectionType => Collection 2015-12-09 17:12:48 -08:00
Dmitri Gribenko
2cf172160c Rename SequenceType.Generator associated type to SequenceType.Iterator 2015-12-09 17:11:05 -08:00
David Farler
8f2fbdc93a Make function parameters and refutable patterns always immutable
All refutable patterns and function parameters marked with 'var'
is now an error.

- Using explicit 'let' keyword on function parameters causes a warning.
- Don't suggest making function parameters mutable
- Remove uses in the standard library
- Update tests

rdar://problem/23378003
2015-11-09 16:56:13 -08:00
Dmitri Hrybenko
6536edd68c stdlib: fix coding style
Swift SVN r32425
2015-10-03 21:13:15 +00:00
Dmitri Hrybenko
f57947a7e0 stdlib: fix capitalization issues in documentation comments
Patch by Nate Cook.

rdar://22054901

Swift SVN r32226
2015-09-25 17:13:54 +00:00
Dmitri Hrybenko
dd3194a18c stdlib: adopt @warn_unused_result
rdar://20957486

Swift SVN r31048
2015-08-06 14:53:18 +00:00
David Farler
311baf73cf Index protocol extensions
- Remove free Swift functions for advance and distance and replace
  them with protocol extension methods:
  - advancedBy(n)
  - advancedBy(n, limit:)
  - distanceTo(end)
- Modernize the Index tests
  - Use StdlibUnittest
  - Test for custom implementation dispatch

Perf impact: No significant changes reported in the
Swift Performance Measurement Tool.

rdar://problem/22085119

Swift SVN r30958
2015-08-03 20:06:44 +00:00
Dmitri Hrybenko
61b93564e9 Eliminate UnsafeMutableBufferPointer from _withUnsafeMutableBufferPointerIfSupported
The type checker hits a recursion when checking the conformance to
CollectionType in UnsafeMutableBufferPointer, which requires
_withUnsafeMutableBufferPointerIfSupported, which mentions
UnsafeMutableBufferPointer.  The easiest fix for now is to break the
recursion in the library.

Reverting this change is tracked by: <rdar://problem/21933004> Restore
the signature of _withUnsafeMutableBufferPointerIfSupported() that
mentions UnsafeMutableBufferPointer

Swift SVN r30838
2015-07-31 03:21:54 +00:00
Joe Groff
1d49d927e1 stdlib: Mark many higher-order function interfaces as 'rethrows'.
This covers:

- Lifetime-extending wrappers, like withExtendedLifetime, withCString, and withUnsafe*Pointer
- 'map' and friends on Optional
- 'indexOf'

A few APIs I haven't gotten to yet in this first pass:

- Autoclosure APIs, like assert, &&, etc.
- the 'isOrderedBefore' predicate for sorting APIs. The sorting implementation does some microoptimizations with 'inout' closures that violate rethrows checking.
- Strict 'map', 'filter', and friends on CollectionType. These need some plumbing in Lazy to be able to thread a Result-forming transformation through.

This version of the patch updates some protocol customization implementations that I missed the first time around, and includes the tests I forgot to add in the previous iteration.

Swift SVN r30790
2015-07-30 05:28:17 +00:00
Joe Groff
b0ec0d6da4 Revert "stdlib: Mark many higher-order function interfaces as 'rethrows'."
This reverts commit r30597, to help detangle it from other potentially-breaking changes that landed
on the bots simultaneously.

Swift SVN r30602
2015-07-24 23:31:59 +00:00
Joe Groff
4be02cab5b stdlib: Mark many higher-order function interfaces as 'rethrows'.
This covers:

- Lifetime-extending wrappers, like withExtendedLifetime, withCString, and withUnsafe*Pointer
- 'map' and friends on Optional
- 'indexOf'

A few APIs I haven't gotten to yet in this first pass:

- Autoclosure APIs, like assert, &&, etc.
- the 'isOrderedBefore' predicate for sorting APIs. The sorting implementation does some microoptimizations with 'inout' closures that violate rethrows checking.
- Strict 'map', 'filter', and friends on CollectionType. These need some plumbing in Lazy to be able to thread a Result-forming transformation through.

Swift SVN r30597
2015-07-24 22:52:23 +00:00
Arnold Schwaighofer
c772380f2c stdlib: Rename IsOrderedBefore to EscapingBinaryPredicate
Swift SVN r30267
2015-07-16 16:35:45 +00:00
Arnold Schwaighofer
4c2dd3ee97 Remove redundant typealias
Swift SVN r30263
2015-07-16 14:20:36 +00:00