Commit Graph

48 Commits

Author SHA1 Message Date
Dave Abrahams
e52fb0694d [stdlib] Unbalanced braces in gyb'd source makes my indentation unhappy.
Swift SVN r30465
2015-07-21 22:01:23 +00:00
Dave Abrahams
03f879bb87 [stdlib] Lazy flatMap
Addresses <rdar://problem/20138472>, can close after API review.

Swift SVN r30370
2015-07-18 06:50:27 +00:00
Dmitri Hrybenko
71022a46c1 stdlib: rename mapping sequence and collection wrappers to a common naming convention
struct ReverseIndex<Base : BidirectionalIndexType> { ... }
  struct ReverseRandomAccessIndex<Base : RandomAccessIndexType> { ... }

  // Renamed from `BidirectionalReverseView`.
  struct ReverseCollection<Base : CollectionType where T.Index : BidirectionalIndexType> { ... }

  // Renamed from `RandomAccessReverseView`.
  struct ReverseRandomAccessCollection<Base : CollectionType where T.Index : RandomAccessIndexType> { ... }

Also fixed a bug (found by the new tests I added in this commit) in
LazyRandomAccessCollection.reverse(), which mistakenly returned a bidirectional
reversed collection.

Part of rdar://21429126

Swift SVN r29634
2015-06-24 20:42:01 +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
53f3ccf850 stdlib: change CollectionType.count() into a property
Swift SVN r28829
2015-05-20 09:14:43 +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
Dave Abrahams
106b39a497 [stdlib] Indent bullet continuations in doc comments
The text is a lot more readable that way.

Swift SVN r28471
2015-05-12 16:59:08 +00:00
Dmitri Hrybenko
33276a4014 stdlib: make _prext_filter() return an Array<Element> for all collections
Swift SVN r28451
2015-05-12 03:02:58 +00:00
Dmitri Hrybenko
7ac7eba882 stdlib: make map() dynamically dispatched
This change tries to recover the performance regression in map() that
was caused by moving map() to a protocol extension and degrading the
static type information (when mapping a collection, we only know that it
is a sequence).  Adding map() to the witness table allows us to provide
a specialized implementation for collections, and hopefully recover the
lost performance.

Swift SVN r28416
2015-05-11 15:59:02 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Dmitri Hrybenko
8b392eeea9 Revert "Remove Array.count, it is redundant with protocol extensions"
This reverts commit r28247 while we discuss the change.

Swift SVN r28292
2015-05-07 21:45:30 +00:00
Dmitri Hrybenko
58601fafc8 Remove Array.count, it is redundant with protocol extensions
Swift SVN r28247
2015-05-07 00:30:41 +00:00
Dmitri Hrybenko
c109ec9125 stdlib: protocol extensions: de-underscore count()
Swift SVN r28246
2015-05-07 00:30:38 +00:00
Dmitri Hrybenko
97db2def53 stdlib: protocol extensions: de-underscore flatMap()
Swift SVN r28239
2015-05-07 00:30:27 +00:00
Dmitri Hrybenko
a474641f66 stdlib: protocol extensions: de-underscore reverse()
Swift SVN r28238
2015-05-07 00:30:26 +00:00
Dmitri Hrybenko
270ec3b67c stdlib: protocol extensions: de-underscore reduce()
Swift SVN r28237
2015-05-07 00:30:25 +00:00
Dmitri Hrybenko
035d72d5a7 stdlib: protocol extensions: de-underscore contains()
Swift SVN r28236
2015-05-07 00:30:24 +00:00
Dmitri Hrybenko
822ad74194 stdlib: protocol extensions: de-underscore lexicographicalCompare()
Swift SVN r28235
2015-05-07 00:30:23 +00:00
Dmitri Hrybenko
78d1196f33 stdlib: protocol extensions: de-underscore elementsEqual
Swift SVN r28234
2015-05-07 00:30:22 +00:00
Dmitri Hrybenko
e43ad56a1c stdlib: protocol extensions: de-underscore startsWith()
Swift SVN r28233
2015-05-07 00:30:21 +00:00
Dmitri Hrybenko
62aa1f0e7c stdlib: protocol extensions: de-underscore minElement(), maxElement()
Swift SVN r28232
2015-05-07 00:30:20 +00:00
Dmitri Hrybenko
7e9063a4af stdlib: protocol extensions: de-underscore enumerate()
Swift SVN r28231
2015-05-07 00:30:12 +00:00
Chris Lattner
37f5452d15 require -> guard.
Swift SVN r28223
2015-05-06 22:53:38 +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
079e8b982b move stdlib from let/else to require.
Swift SVN r28098
2015-05-03 21:45:06 +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
ffc6f62b93 stdlib: doc comments: clarify the behavior of algorithms on SequenceType
These clarifications were requested in API review.

Swift SVN r27951
2015-04-30 00:27:49 +00:00
Dmitri Hrybenko
16ab7b4a3b stdlib: rename equalElements() to elementsEqual() per API review
Swift SVN r27937
2015-04-29 22:34:59 +00:00
Dmitri Hrybenko
70d728efef stdlib: remove the staged API changes for zip()
API review has reached consensus that zip() reads better as a free
function.

Swift SVN r27921
2015-04-29 21:30:02 +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
730e6afee0 Revert "stdlib: make map() dynamically dispatched"
This reverts commit r27607.  It broke parse_stdlib_* tests.

Swift SVN r27609
2015-04-22 22:30:45 +00:00
Dmitri Hrybenko
21e5a83631 stdlib: make map() dynamically dispatched
This change tries to recover the performance regression in map() that
was caused by moving map() to a protocol extension and degrading the
static type information (when mapping a collection, we only know that it
is a sequence).  Adding map() to the witness table allows us to provide
a specialized implementation for collections, and hopefully recover the
lost performance.

This is a speculative change, I don't have performance numbers.  I will
watch the performance buildbots and if this change does not help, I'll
revert.

Swift SVN r27607
2015-04-22 22:08:16 +00:00
Dmitri Hrybenko
7a40ec0916 stdlib: simplify code
Swift SVN r27601
2015-04-22 20:42:01 +00:00
Dmitri Hrybenko
701dfbecd2 stdlib: use let-else in maxElement()
Swift SVN r27571
2015-04-22 07:06:40 +00:00
Dmitri Hrybenko
7bbb0071a3 stdlib: fix a bug in SequenceType.startsWith() introduced in r27567
Swift SVN r27569
2015-04-22 07:06:39 +00:00
Chris Lattner
3ec09eec8e force adopt let/else and the Swift 1.2 if/let extensions in the stdlib a bit, for dogfooding
and cleanup.

I changes cases that had a non-trivial "then" body but a trivial else.  Most of the cases in
the stdlib have a trivial "then" clause, so I didn't change them.




Swift SVN r27567
2015-04-22 06:24:06 +00:00
Dmitri Hrybenko
b68fdd2316 stdlib: reword doc comment for SequenceType.flatMap()
Swift SVN r27559
2015-04-22 04:32:41 +00:00
Dmitri Hrybenko
31831c44bb stdlib: change non-API names to be more descriptive
Swift SVN r27558
2015-04-22 04:32:38 +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
2bccb13463 stdlib: add an extension point for SequenceType.contains()
This makes the protocol extension as fast as static dispatch for
Set.contains().

Swift SVN r27396
2015-04-17 02:09:59 +00:00
Dmitri Hrybenko
581e853428 stdlib: make filter() a protocol requirement for range replaceable collections
This allows array types to get the best performance.  The default
implementation for range replaceable collections appends elements one by
one, and the optimizer can't hoist uniqueness checks from the loop in
that case yet.

Swift SVN r27314
2015-04-15 05:17:28 +00:00
Dmitri Hrybenko
0af19e7ff3 stdlib: use unsafeBitCast to implement map() and filter() on top of lazy()
Array(other_collection) is using an optimized code path for copying
collections.  An explicit for loop does not.

This commit should recover the performance regression in
rdar://20530390.

Swift SVN r27313
2015-04-15 05:17:27 +00:00
Dmitri Hrybenko
c4b82718d5 stdlib: correct comment
Swift SVN r27312
2015-04-15 05:17:20 +00:00
Dmitri Hrybenko
6e09dad1e6 stdlib: move sequence and collection algorithms to topic-centered files
Swift SVN r27273
2015-04-14 07:03:49 +00:00