Commit Graph

51 Commits

Author SHA1 Message Date
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
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00: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
Arnold Schwaighofer
27f792f308 Re-@noescape the isOrderedBefore closure argument to sort
The blocking optimization was added.

rdar://21024092

Swift SVN r30227
2015-07-15 21:44:45 +00:00
Dmitri Hrybenko
a725d1e7e3 Fix a comment in a test
Swift SVN r30046
2015-07-09 23:24:59 +00:00
Greg Parker
6c812d0751 [stdlib] Reinstate r29043 "strip final from protocol extensions".
This reverts r29050. This wasn't the change that broke the SourceKit tests.


Swift SVN r29052
2015-05-27 01:52:17 +00:00
Greg Parker
16a3b8ebd7 [stdlib] Revert "strip final from protocol extensions".
SourceKit tests need to be updated.


Swift SVN r29050
2015-05-27 01:34:45 +00:00
Dave Abrahams
1f1643221d [stdlib] strip final from protocol extensions
Now that we've lifted the requirement

Swift SVN r29043
2015-05-26 23:52:36 +00:00
Dmitri Hrybenko
1519c85340 stdlib: annotate sort() method with @warn_unused_result
rdar://20775645

Swift SVN r28869
2015-05-21 06:27:27 +00:00
Dmitri Hrybenko
fe239e3d03 stdlib: de-underscore sort() and partition() methods
Swift SVN r28839
2015-05-20 19:34:36 +00:00
Dmitri Hrybenko
53f3ccf850 stdlib: change CollectionType.count() into a property
Swift SVN r28829
2015-05-20 09:14:43 +00:00
Dmitri Hrybenko
4a677190eb stdlib: move partition() to a protocol extension
Swift SVN r28816
2015-05-20 03:12:55 +00:00
Arnold Schwaighofer
1cf4974ad7 Remove a noescape and bitcast that were causing extra thunks to hang around
We were generating two reabstraction thunks from
(Generator.Element, Generator.Element) -> Bool
back to
(Generator.Element, Generator.Element) -> Bool
for the let bitcast.

rdar://21022339

Swift SVN r28778
2015-05-19 18:51:12 +00:00
Dmitri Hrybenko
47595ee1db stdlib: change sort() and sorted() into protocol extensions
Swift SVN r28736
2015-05-19 01:55:29 +00:00
Dmitri Hrybenko
17cafb6b3a Revert "stdlib: don't use doc comment markup for non-doc comments"
This reverts commit 28724.  It contains unintended changes.

Swift SVN r28725
2015-05-18 21:51:53 +00:00
Dmitri Hrybenko
e964eb7384 stdlib: don't use doc comment markup for non-doc comments
rdar://problem/20976063

Swift SVN r28724
2015-05-18 21:50:24 +00:00
Dmitri Hrybenko
313701286b stdlib: Various punctuation and markup improvements to the comments.
Patch by Brian Lanier.

Swift SVN r28659
2015-05-16 03:04:51 +00:00
Dmitri Hrybenko
68ef59e37a stdlib: Convert comments to use '- requires:' instead of 'Requires:'.
Tidy misc. comments and markdown along the way.

Patch by Brian Lanier.

Swift SVN r28473
2015-05-12 17:47:11 +00:00
Dave Abrahams
5c55682d8b [stdlib] Capitalize keywords in doc comments
Again, the text is a lot more readable that way.

Swift SVN r28472
2015-05-12 16:59:13 +00:00
Dmitri Hrybenko
4925bda845 stdlib: make 'first' dynamically dispatched so that it can be made fast
on Dictionary and Set

Swift SVN r28453
2015-05-12 04:46:26 +00:00
Dmitri Hrybenko
e253881b02 stdlib: protocol extensions: de-underscore indices
Swift SVN r28245
2015-05-07 00:30:35 +00:00
Dmitri Hrybenko
f76ca6243e stdlib: protocol extensions: de-underscore indexOf()
Swift SVN r28244
2015-05-07 00:30:33 +00:00
Dmitri Hrybenko
25e74d21db stdlib: protocol extensions: de-underscore last
Swift SVN r28243
2015-05-07 00:30:32 +00:00
Dmitri Hrybenko
d790954154 stdlib: protocol extensions: de-underscore first
Swift SVN r28242
2015-05-07 00:30:30 +00:00
Dmitri Hrybenko
e96ade89a9 stdlib: protocol extensions: de-underscore isEmpty
Swift SVN r28241
2015-05-07 00:30:29 +00:00
Doug Gregor
2105aa7394 Remove extraneous 'Self.' from constrained extension where clauses.
NFC; cleans up the standard library implementation slightly.

Swift SVN r28209
2015-05-06 17:05:29 +00:00
Chris Lattner
31c01eab73 Change the meaning of "if let x = foo()" back to Xcode 6.4 semantics. The compiler
includes a number of QoI things to help people write the correct code.  I will commit
the testcase for it as the next patch.

The bulk of this patch is moving the stdlib, testsuite and validation testsuite to
the new syntax.  I moved a few uses of "as" patterns back to as? expressions in the 
stdlib as well.



Swift SVN r27959
2015-04-30 04:38:13 +00:00
Dmitri Hrybenko
4d197dc5b2 Revert "stdlib: change sort() and sorted() into methods"
This reverts commits r27885, r27876.  It looks like they broke iOS on
arm64.

Swift SVN r27893
2015-04-28 23:58:50 +00:00
Dmitri Hrybenko
b05c372c4f stdlib: change sort() and sorted() into methods
Swift SVN r27876
2015-04-28 18:05:37 +00:00
Dmitri Hrybenko
fd14e70e48 stdlib: rename find() to indexOf() per API review
Swift SVN r27849
2015-04-28 00:30:37 +00:00
Dmitri Hrybenko
f6090c1c89 stdlib: make CollectionType._prext_isEmpty dynamically dispatched
This change makes isEmpty faster for Dictionary and Set, when invoked
from generic algorithms.

Swift SVN r27736
2015-04-26 00:08:14 +00:00
David Farler
9e28dc777a Update standard library doc comments to Markdown
rdar://problem/20180478

Swift SVN r27726
2015-04-26 00:07:11 +00:00
Dmitri Hrybenko
af38ea1381 stdlib: add MutableCollectionType._prext_partition()
Swift SVN r27643
2015-04-23 20:52:00 +00:00
Dmitri Hrybenko
d9848a6c41 stdlib: migrate last() to use a protocol extension
Swift SVN r27602
2015-04-22 20:42:04 +00:00
Dmitri Hrybenko
62403ecc23 stdlib: fix up documentation for new methods
Swift SVN r27510
2015-04-21 00:15:03 +00:00
Dmitri Hrybenko
02d254047b stdlib: add a hook for dynamic dispatch in CollectionType.find()
This hook allows Set.find() to be equally efficient in static and
generic contexts.

This time, with correct tests.

Swift SVN r27404
2015-04-17 05:03:28 +00:00
Dmitri Hrybenko
e94b0f9b40 Revert "stdlib: add a hook for dynamic dispatch in CollectionType.find()"
This reverts commit r27402.  It broke tests.

Swift SVN r27403
2015-04-17 04:59:29 +00:00
Dmitri Hrybenko
fe53f87dfc stdlib: add a hook for dynamic dispatch in CollectionType.find()
This allows Set.find() to be equally efficient in static and generic
contexts.

Swift SVN r27402
2015-04-17 04:19:49 +00:00